Primitive Root

DOWNLOAD Mathematica Notebook

A primitive root of a prime p is an integer g such that g (mod p) has multiplicative order p-1 (Ribenboim 1996, p. 22). More generally, if GCD(g,n)=1 (g and n are relatively prime) and g is of multiplicative order phi(n) modulo n where phi(n) is the totient function, then g is a primitive root of n (Burton 1989, p. 187). The first definition is a special case of the second since phi(p)=p-1 for p a prime.

A primitive root of a number n (but not necessarily the smallest primitive root for composite n) can be computed in the Wolfram Language using PrimitiveRoot[n].

If n has a primitive root, then it has exactly phi(phi(n)) of them (Burton 1989, p. 188), which means that if p is a prime number, then there are exactly phi(p-1) incongruent primitive roots of p (Burton 1989). For n=1, 2, ..., the first few values of phi(phi(n)) are 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 2, 4, 2, 4, 4, 8, ... (OEIS A010554). n has a primitive root if it is of the form 2, 4, p^a, or 2p^a, where p is an odd prime and a>=1 (Burton 1989, p. 204). The first few n for which primitive roots exist are 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 17, 18, 19, 22, ... (OEIS A033948), so the number of primitive root of order n for n=1, 2, ... are 0, 1, 1, 1, 2, 1, 2, 0, 2, 2, 4, 0, 4, ... (OEIS A046144).

The smallest primitive roots for the first few primes p are 1, 2, 2, 3, 2, 2, 3, 2, 5, 2, 3, 2, 6, 3, 5, 2, 2, 2, ... (OEIS A001918). Here is table of the primitive roots for the first few n for which a primitive root exists (OEIS A046147).

ng(n)
21
32
43
52, 3
65
73, 5
92, 5
103, 7
112, 6, 7, 8
132, 6, 7, 11

The largest primitive roots for n=1, 2, ..., are 0, 1, 2, 3, 3, 5, 5, 0, 5, 7, 8, 0, 11, ... (OEIS A046146). The smallest primitive roots for the first few integers n are given in the following table (OEIS A046145), which omits n when g(n) does not exist.

213839451583
324169751625
434339831632
5246510121665
6547510351675
7349310631692
9250310721732
10353210961783
11254511331792
132583118111812
143592121219119
17361212271935
18562312521945
19267212731972
22771713121993
23573513472023
25274513732065
26779313922112
27281214272145
292827146521811
31383214922233
34386315162263
37289315752272

Let p be any odd prime k>=1, and let

 s=sum_(j=1)^(p-1)j^k.
(1)

Then

 s={-1 (mod p)   for p-1|k;  0 (mod p)   for p-1k
(2)

(Ribenboim 1996, pp. 22-23). For numbers m with primitive roots, all y satisfying (m,y)=1 are representable as

 y=g^t (mod m),
(3)

where t=0, 1, ..., phi(m)-1, t is known as the index, and y is an integer. Kearnes (1984) showed that for any positive integer m, there exist infinitely many primes p such that

 m<g_p<p-m.
(4)

Call the least primitive root g_p. Burgess (1962) proved that

 g_p<=Cp^(1/4+epsilon)
(5)

for C and epsilon positive constants and p sufficiently large (Ribenboim 1996, p. 24).

Matthews (1976) obtained a formula for the "two-dimensional" Artin's constants for the set of primes for which m and n are both primitive roots.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.