numlib::msqrts -- modular square
roots
Introductionnumlib::msqrts(a,m) returns the list of
all integers 0 <= x <= m-1 such that (x^2-a) mod
m = 0.
Call(s)numlib::msqrts(a, m)
Parametersa |
- | an integer |
m |
- | a natural number relatively prime to
a |
Returnsnumlib::msqrts(a,m) returns a list of
nonnegative integers
Related
Functionsnumlib::lincongruence,
numlib::mroots
Detailsnumlib::msqrts(a,m) returns the function
call with evaluated arguments if one of the arguments is not a
number.numlib::msqrts returns an error if the arguments
evaluate to numbers which are not both of the correct type.
Example
1Computing the square roots of modulo :
>> numlib::msqrts(132132,3231227)
[219207, 3012020]
Example
2There are no square roots of modulo :
>> numlib::msqrts(222222,324899)
[]
Example
3Computing the square roots of modulo :
>> numlib::msqrts(37,48884)
[383, 585, 23857, 24059, 24825, 25027, 48299, 48501]
Backgroundnumlib::msqrts uses D. Shanks' algorithm
RESSOL.