This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

PrimitiveRoot

PrimitiveRoot[n]
gives the smallest primitive root of n.
  • PrimitiveRoot[n] gives the smallest generator for the multiplicative group of integers modulo n relatively prime to n.
  • PrimitiveRoot[n] returns unevaluated if n is not 2, 4, an odd prime power or twice an odd prime power.
A primitive root of 9 is 2:
The primitive root generates all integers modulo 9 that are relatively prime to 9:
A primitive root of 9 is 2:
In[1]:=
Click for copyable input
Out[1]=
The primitive root generates all integers modulo 9 that are relatively prime to 9:
In[2]:=
Click for copyable input
Out[2]=
PrimitiveRoot automatically threads over lists:
The multiplicative order of a primitive root modulo n is EulerPhi[n]:
For a prime p, there exist EulerPhi primitive roots modulo p:
PrimitiveRoot is not defined for all integers:
Elements relatively prime to are enumerated by the primitive root:
New in 6