 Roots of Unity - Maple Help

NumberTheory

 RootsOfUnity
 modular roots of unity Calling Sequence RootsOfUnity(k, n) Parameters

 k - prime number n - positive integer Description

 • The RootsOfUnity(k, n) command computes all the kth roots of unity modulo n.
 • An integer $x$ is said to be a $k$th root of unity modulo $n$ if ${x}^{k}=1\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}n$. Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$
 > $\mathrm{unity}≔\mathrm{RootsOfUnity}\left(5,8965\right)$
 ${\mathrm{unity}}{≔}\left\{{1}{,}{1631}{,}{2446}{,}{3261}{,}{6521}\right\}$ (1)
 > $\mathrm{map}\left(x↦{x}^{5}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}8965,\mathrm{unity}\right)$
 $\left\{{1}\right\}$ (2)

Distribution of the second roots of unity. A point $x,y$ on the plot denotes that $y$ is a second root of unity modulo $x$.

 > $\mathrm{plots}:-\mathrm{pointplot}\left(\mathrm{select}\left(p↦{p\left[2\right]}^{2}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}p\left[1\right]=1,\left[\mathrm{seq}\left(\mathrm{seq}\left(\left[i,j\right],j=0..i-1\right),i=1..1000\right)\right]\right),\mathrm{labels}=\left["Modulus","Second roots of unity"\right],\mathrm{labeldirections}=\left[\mathrm{horizontal},\mathrm{vertical}\right]\right)$  Compatibility

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