Modular Square Root - Maple Help

Online Help

All Products    Maple    MapleSim


NumberTheory

  

ModularSquareRoot

  

modular square root

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ModularSquareRoot(x, n)

Parameters

x

-

integer

n

-

positive integer

Description

• 

The ModularSquareRoot function computes a non-negative integer y such that y2=xmodn if possible. If not possible, an error message is displayed.

• 

When x has more than one square root, any one of them may be returned.

Examples

withNumberTheory:

The follow numbers have square roots modulo 37.

residuesseqi2mod37,i=0..36

residues0,1,3,4,7,9,10,11,12,16,21,25,26,27,28,30,33,34,36

(1)

30 has a square root modulo 37.

evalb30inresidues

true

(2)

ModularSquareRoot30,37

17

(3)

172mod37

30

(4)

24 does not have a square root modulo 37 and so an error message is displayed.

evalb24inresidues

false

(5)

ModularSquareRoot24,37

Error, (in NumberTheory:-ModularSquareRoot) 24 is a quadratic non-residue modulo 37

Compatibility

• 

The NumberTheory[ModularSquareRoot] command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

NumberTheory

NumberTheory[ImaginaryUnit]

NumberTheory[ModularRoot]

NumberTheory[PrimitiveRoot]

NumberTheory[RootsOfUnity]