NumberTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Number Theory : NumberTheory/ModularRoot

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

 > with(NumberTheory):

The following numbers have cube roots modulo $24$.

 > residues := {seq(i^3 mod 24, i = 0..23)};
 ${\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$.

 > evalb(13 in residues);
 ${\mathrm{true}}$ (2)
 > ModularRoot(13, 3, 24);
 ${13}$ (3)
 > 13^3 mod 24;
 ${13}$ (4)

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

 > evalb(12 in residues);
 ${\mathrm{false}}$ (5)
 > ModularRoot(12, 3, 24);

Compatibility

 • The NumberTheory[ModularRoot] command was introduced in Maple 2016.