numlib::order -- order of a
residue class
Introductionnumlib::order(a,m) returns the order of
the residue class modulo m of a in the group
of units modulo m if a and m are
coprime.
Call(s)numlib::order(a, m)
Parametersa |
- | an integer |
m |
- | a natural number |
Returnsnumlib::order(a,m) returns a natural
number if a is coprime to m, and FAIL if a is not
coprime to m.
Related
Functions
Detailsnumlib::order(a,m) returns the function
call with its arguments evaluated if a or m
is not a number.numlib::order returns an error if one of the arguments
evaluates to a number of wrong type.
Example
1We compute the order of the residue class of in the unit group modulo :
>> numlib::order(23, 2161)
2160
Example
2We compute the order of all elements in the unit group modulo :
>> map([$ 1..12],numlib::order,13)
[1, 12, 3, 6, 4, 12, 12, 4, 3, 6, 12, 2]
Example
3The residue class of 7 modulo isn't a unit in the ring :
>> numlib::order(7,21)
FAIL
Backgroundnumlib::order uses ifactor and numlib::phi.