numlib::primroot -- primitive
roots
Introductionnumlib::primroot(m) returns the least
positive primitive root modulo m if there exist primitive
roots modulo m.
numlib::primroot(a, m) returns the least
primitive root modulo m not smaller than a if
there exist primitive roots modulo m.
Call(s)numlib::primroot(m)
numlib::primroot(a, m)
Parametersa |
- | an integer |
m |
- | a natural number |
Returnsnumlib::primroot returns an integer or FAIL.
Related
Functions
Detailsnumlib::primroot returns FAIL if there exist no primitive roots
modulo m.numlib::primroot returns the function call with
evaluated argument(s) if at least one argument is not a number.numlib::primroot returns an error if the arguments
evaluate to numbers which are not both of the correct type.
Example
1We compute the least positive primitive root modulo the prime number 40487:
>> numlib::primroot(40487)
5
Example
2We compute the least primitive root modulo 404872 = 1639197169:
>> numlib::primroot(1639197169)
10
Example
3Now we compute least primitive root modulo which is :
>> numlib::primroot(111111111,40487)
111111116
Example
4There are no primitive roots modulo 324013370:
>> numlib::primroot(324013370)
FAIL
Backgroundnumlib::primroot uses ifactor.