Modular Root - Maple Help

# Online Help

###### All Products    Maple    MapleSim

NumberTheory

 ModularRoot
 modular root

 Calling Sequence ModularRoot(x, r, n)

Parameters

 x - integer r - non-negative integer n - positive integer

Description

 • The ModularRoot function computes a non-negative integer $y$ such that ${y}^{r}=x\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}n$ if possible. If not possible, an error message is displayed.
 • When x has more than one roots of order r, any one of them may be returned.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$

The following numbers have cube roots modulo $24$.

 > $\mathrm{residues}≔\left\{\mathrm{seq}\left({i}^{3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}24,i=0..23\right)\right\}$
 ${\mathrm{residues}}{≔}\left\{{0}{,}{1}{,}{3}{,}{5}{,}{7}{,}{8}{,}{9}{,}{11}{,}{13}{,}{15}{,}{16}{,}{17}{,}{19}{,}{21}{,}{23}\right\}$ (1)

$13$ has a cube root modulo $24$.

 > $\mathrm{evalb}\left(13\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{residues}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{ModularRoot}\left(13,3,24\right)$
 ${13}$ (3)
 > ${13}^{3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}24$
 ${13}$ (4)

$12$ does not have a cube root modulo $24$ and so an error message is displayed.

 > $\mathrm{evalb}\left(12\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{residues}\right)$
 ${\mathrm{false}}$ (5)
 > $\mathrm{ModularRoot}\left(12,3,24\right)$

Compatibility

 • The NumberTheory[ModularRoot] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.

 See Also