NumberTheory
PrimitiveRoot
primitive root modulo n
Calling Sequence
Parameters
Description
Examples
Compatibility
PrimitiveRoot(n, options)
n
-
positive integer
options
(optional) at most one of greaterthan = m or ith = i, where m is a non-negative integer and i is a positive integer
The PrimitiveRoot(n) command returns the smallest primitive root modulo n, if it exists.
The PrimitiveRoot(n, greaterthan = m) command returns the smallest primitive root modulo n greater than m.
The PrimitiveRoot(n, ith = i) command returns the ith smallest primitive root modulo n.
If the required primitive root does not exist, then an error message is displayed.
The integers that are coprime to n form a group of order Totient(n) under multiplication modulo n. If this group is cyclic, then a generator is called a primitive root modulo n. That is, if p is a primitive root modulo n, then every integer coprime to n is congruent to some power of p modulo n.
If a primitive root modulo n exists, then the number of primitive roots is Totient(Totient(n)).
with⁡NumberTheory:
PrimitiveRoot⁡4
3
Totient⁡Totient⁡4
1
So 3 is the only primitive root modulo 4.
PrimitiveRoot⁡7
Totient⁡Totient⁡7
2
So there are two primitive roots modulo 7.
PrimitiveRoot⁡7,greaterthan=3
5
Both 3 and 5 are generators for the group of units under multiplication modulo 7.
seq⁡3imod7,i=1..Totient⁡7,seq⁡5imod7,i=1..Totient⁡7
3,2,6,4,5,1,5,4,6,2,3,1
Since the maximal order modulo 8 is less than φ⁡8, a primitive root does not exist and an error message is displayed.
seq⁡3nmod8,n=0..2,seq⁡5nmod8,n=0..2,seq⁡7nmod8,n=0..2
1,3,1,1,5,1,1,7,1
Totient⁡8
4
PrimitiveRoot⁡8
Error, (in NumberTheory:-PrimitiveRoot) there does not exist a primitive root modulo 8
List all the primitive roots modulo 27, if any exist.
PrimitiveRoot⁡27
seq⁡PrimitiveRoot⁡27,ith=i,i=1..Totient⁡Totient⁡27
2,5,11,14,20,23
The NumberTheory[PrimitiveRoot] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
NumberTheory[MultiplicativeOrder]
NumberTheory[PseudoPrimitiveRoot]
Download Help Document