PrimitiveRoot

PrimitiveRoot[n]

gives a primitive root of n.

PrimitiveRoot[n,k]

gives the smallest primitive root of n greater than or equal to k.

Details

  • PrimitiveRoot[n] gives a 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.
  • PrimitiveRoot[n,1] computes the smallest primitive root of n.

Examples

open allclose all

Basic Examples  (2)

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]=

A primitive root of 10:

In[1]:=
Click for copyable input
Out[1]=

The smallest primitive root of 10:

In[2]:=
Click for copyable input
Out[2]=

Scope  (3)

Properties & Relations  (2)

Possible Issues  (1)

Neat Examples  (1)

See Also

PrimitiveRootList  MultiplicativeOrder  EulerPhi  CarmichaelLambda  PowerMod  DirichletCharacter

Tutorials

Introduced in 2007
(6.0)
| Updated in 2015
(10.3)