Imaginary Unit - Maple Help

NumberTheory

 ImaginaryUnit
 modular square root of -1

 Calling Sequence ImaginaryUnit(n)

Parameters

 n - positive integer

Description

 • The ImaginaryUnit function returns a square root of $-1$ modulo n, if possible. If not possible, an error message is displayed.
 • If there is more than one imaginary unit, only one of them is returned.

Examples

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

There exists an imaginary unit modulo $5$.

 > $\mathrm{ImaginaryUnit}\left(5\right)$
 ${3}$ (1)
 > ${3}^{2}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}5$
 ${4}$ (2)

Since there does not exist an imaginary unit modulo $6$, an error message is displayed.

 > $\mathrm{ImaginaryUnit}\left(6\right)$
 > $\mathrm{seq}\left({i}^{2}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{mod}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}6,i=0..5\right)$
 ${0}{,}{1}{,}{4}{,}{3}{,}{4}{,}{1}$ (3)

Compatibility

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