Primitive root modulo n

In modular arithmetic, a branch of number theory, a number g is a primitive root modulo n if every number a coprime to n is congruent to a power of g modulo n. That is, g is a primitive root modulo n if for every integer a coprime to n, there is an integer k such that gka (mod n). Such a value k is called the index or discrete logarithm of a to the base g modulo n. Note that g is a primitive root modulo n if and only if g is a generator of the multiplicative group of integers modulo n.

Gauss defined primitive roots in Article 57 of the Disquisitiones Arithmeticae (1801), where he credited Euler with coining the term. In Article 56 he stated that Lambert and Euler knew of them, but he was the first to rigorously demonstrate that primitive roots exist for a prime n. In fact, the Disquisitiones contains two proofs: the one in Article 54 is a nonconstructive existence proof, while the other in Article 55 is constructive.

Elementary example

The number 3 is a primitive root modulo 7[1] because

Here we see that the period of 3k modulo 7 is 6. The remainders in the period, which are 3, 2, 6, 4, 5, 1, form a rearrangement of all nonzero remainders modulo 7, implying that 3 is indeed a primitive root modulo 7. This derives from the fact that a sequence (gk modulo n) always repeats after some value of k, since modulo n produces a finite number of values. If g is a primitive root modulo n and n is prime, then the period of repetition is n−1. Curiously, permutations created in this way (and their circular shifts) have been shown to be Costas arrays.

Definition

If n is a positive integer, the integers between 0 and n − 1 that are coprime to n (or equivalently, the congruence classes coprime to n) form a group, with multiplication modulo n as the operation; it is denoted by Z×
n
, and is called the group of units modulo n, or the group of primitive classes modulo n. As explained in the article multiplicative group of integers modulo n, this multiplicative group (Z×
n
) is cyclic if and only if n is equal to 2, 4, pk, or 2pk where pk is a power of an odd prime number.[2][3][4] When (and only when) this group Z×
n
is cyclic, a generator of this cyclic group is called a primitive root modulo n[5] (or in fuller language primitive root of unity modulo n, emphasizing its role as a fundamental solution of the roots of unity polynomial equations Xm
− 1 in the ring Z
n
), or simply a primitive element of Z×
n
. When Z×
n
is non-cyclic, such primitive elements mod n do not exist.

For any n (whether or not Z×
n
is cyclic), the order of (i.e., the number of elements in) Z×
n
is given by Euler's totient function φ(n) (sequence A000010 in the OEIS). And then, Euler's theorem says that aφ(n) ≡ 1 (mod n) for every a coprime to n; the lowest power of a that is congruent to 1 modulo n is called the multiplicative order of a modulo n. In particular, for a to be a primitive root modulo n, φ(n) has to be the smallest power of a that is congruent to 1 modulo n.

Examples

For example, if n = 14 then the elements of Z×
n
are the congruence classes {1, 3, 5, 9, 11, 13}; there are φ(14) = 6 of them. Here is a table of their powers modulo 14:

 x     x, x2, x3, ... (mod 14) 
 1 :   1 
 3 :   3,  9, 13, 11,  5,  1  
 5 :   5, 11, 13,  9,  3,  1
 9 :   9, 11,  1
11 :  11,  9,  1
13 :  13,  1

The order of 1 is 1, the orders of 3 and 5 are 6, the orders of 9 and 11 are 3, and the order of 13 is 2. Thus, 3 and 5 are the primitive roots modulo 14.

For a second example let n = 15. The elements of Z×
15
are the congruence classes {1, 2, 4, 7, 8, 11, 13, 14}; there are φ(15) = 8 of them.

 x     x, x2, x3, ... (mod 15) 
 1 :   1 
 2 :   2,  4,  8, 1  
 4 :   4,  1
 7 :   7,  4, 13, 1
 8 :   8,  4,  2, 1
11 :  11,  1
13 :  13,  4,  7, 1
14 :  14,  1

Since there is no number whose order is 8, there are no primitive roots modulo 15. Indeed, λ(15) = 4, where λ is the Carmichael function. (sequence A002322 in the OEIS)

Table of primitive roots

Numbers that have a primitive root are

1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 17, 18, 19, 22, 23, 25, 26, 27, 29, 31, 34, 37, 38, 41, 43, 46, 47, 49, 50, 53, 54, 58, 59, 61, 62, 67, 71, 73, 74, 79, 81, 82, 83, 86, 89, 94, 97, 98, 101, 103, 106, 107, 109, 113, 118, 121, 122, 125, 127, 131, 134, 137, 139, 142, 146, 149, ... (sequence A033948 in the OEIS)

This is Gauss's table of the primitive roots from the Disquisitiones. Unlike most modern authors he did not always choose the smallest primitive root. Instead, he chose 10 if it is a primitive root; if it isn't, he chose whichever root gives 10 the smallest index, and, if there is more than one, chose the smallest of them. This is not only to make hand calculation easier, but is used in § VI where the periodic decimal expansions of rational numbers are investigated.

The rows of the table are labelled with the prime powers (excepting 2, 4, and 8) less than 100; the second column is a primitive root modulo that number. The columns are labelled with the primes less than 100. The entry in row p, column q is the index of q modulo p for the given root.

For example, in row 11, 2 is given as the primitive root, and in column 5 the entry is 4. This means that 24 = 16 ≡ 5 (mod 11).

For the index of a composite number, add the indices of its prime factors.

For example, in row 11, the index of 6 is the sum of the indices for 2 and 3: 21 + 8 = 512 ≡ 6 (mod 11). The index of 25 is twice the index 5: 28 = 256 ≡ 25 (mod 11). (Of course, since 25 ≡ 3 (mod 11), the entry for 3 is 8).

The table is straightforward for the odd prime powers. But the powers of 2 (16, 32, and 64) do not have primitive roots; instead, the powers of 5 account for one-half of the odd numbers less than the power of 2, and their negatives modulo the power of 2 account for the other half. All powers of 5 are ≡ 5 or 1 (mod 8); the columns headed by numbers ≡ 3 or 7 (mod 8) contain the index of its negative. (Sequence A185189 and A185268 in OEIS)

For example, modulo 32 the index for 7 is 2, and 52 = 25 ≡ −7 (mod 32), but the entry for 17 is 4, and 54 = 625 ≡ 17 (mod 32).

Primitive roots and indices
(other columns are the indices of integers under respective column headings)
n root 2 3 5 7 11   13 17 19 23 29   31 37 41 43 47   53 59 61 67 71   73 79 83 89 97
32 1
52 13
73 215
92 1*54
112 1847
136 589711
165 *31213
1710 1011791312
1910 1752126138
2310 8201521312175
252 17*51619131811
272 1*516138151211
2910 1127182023271524
3117 121320429231222127
325 *3125747630
375 1134128613525211527
416 261522393313393672832
4328 39175764016292025323518
4710 30181738273422939435242537
4910 21341*16931353224738273623
5326 259313846284241396452233308
5910 25323444452814222747412135328
6110 4742142345204922392513331841405117
645 *3110515127141189141312513
6712 2993976123826202243441963643545
7162 58181433432773854133055441759293711
735 86133555921624635116445131535585044
7929 50713419707491052176232147557177554334
8111 25*352213815125714242910134553420334852
8350 352812472674591636326038496913203453174347
8930 72871874658253312957776759341045193226684627
9710 86211538283192779472641714460146532512520429118
n root 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

The following table lists the primitive roots modulo n for n ≤ 72:

primitive roots modulo order (OEIS: A000010) primitive roots modulo order (OEIS: A000010)
1 0 1 37 2, 5, 13, 15, 17, 18, 19, 20, 22, 24, 32, 35 36
2 1 1 38 3, 13, 15, 21, 29, 33 18
3 2 2 39 24
4 3 2 40 16
5 2, 3 4 41 6, 7, 11, 12, 13, 15, 17, 19, 22, 24, 26, 28, 29, 30, 34, 35 40
6 5 2 42 12
7 3, 5 6 43 3, 5, 12, 18, 19, 20, 26, 28, 29, 30, 33, 34 42
8 4 44 20
9 2, 5 6 45 24
10 3, 7 4 46 5, 7, 11, 15, 17, 19, 21, 33, 37, 43 22
11 2, 6, 7, 8 10 47 5, 10, 11, 13, 15, 19, 20, 22, 23, 26, 29, 30, 31, 33, 35, 38, 39, 40, 41, 43, 44, 45 46
12 4 48 16
13 2, 6, 7, 11 12 49 3, 5, 10, 12, 17, 24, 26, 33, 38, 40, 45, 47 42
14 3, 5 6 50 3, 13, 17, 23, 27, 33, 37, 47 20
15 8 51 32
16 8 52 24
17 3, 5, 6, 7, 10, 11, 12, 14 16 53 2, 3, 5, 8, 12, 14, 18, 19, 20, 21, 22, 26, 27, 31, 32, 33, 34, 35, 39, 41, 45, 48, 50, 51 52
18 5, 11 6 54 5, 11, 23, 29, 41, 47 18
19 2, 3, 10, 13, 14, 15 18 55 40
20 8 56 24
21 12 57 36
22 7, 13, 17, 19 10 58 3, 11, 15, 19, 21, 27, 31, 37, 39, 43, 47, 55 28
23 5, 7, 10, 11, 14, 15, 17, 19, 20, 21 22 59 2, 6, 8, 10, 11, 13, 14, 18, 23, 24, 30, 31, 32, 33, 34, 37, 38, 39, 40, 42, 43, 44, 47, 50, 52, 54, 55, 56 58
24 8 60 16
25 2, 3, 8, 12, 13, 17, 22, 23 20 61 2, 6, 7, 10, 17, 18, 26, 30, 31, 35, 43, 44, 51, 54, 55, 59 60
26 7, 11, 15, 19 12 62 3, 11, 13, 17, 21, 43, 53, 55 30
27 2, 5, 11, 14, 20, 23 18 63 36
28 12 64 32
29 2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26, 27 28 65 48
30 8 66 20
31 3, 11, 12, 13, 17, 21, 22, 24 30 67 2, 7, 11, 12, 13, 18, 20, 28, 31, 32, 34, 41, 44, 46, 48, 50, 51, 57, 61, 63 66
32 16 68 32
33 20 69 44
34 3, 5, 7, 11, 23, 27, 29, 31 16 70 24
35 24 71 7, 11, 13, 21, 22, 28, 31, 33, 35, 42, 44, 47, 52, 53, 55, 56, 59, 61, 62, 63, 65, 67, 68, 69 70
36 12 72 24

Artin's conjecture on primitive roots states that a given integer a that is neither a perfect square nor 1 is a primitive root modulo infinitely many primes.

The sequence of smallest primitive roots modulo n (which is not the same as the sequence of primitive roots in Gauss's table) are

0, 1, 2, 3, 2, 5, 3, 0, 2, 3, 2, 0, 2, 3, 0, 0, 3, 5, 2, 0, 0, 7, 5, 0, 2, 7, 2, 0, 2, 0, 3, 0, 0, 3, 0, 0, 2, 3, 0, 0, 6, 0, 3, 0, 0, 5, 5, 0, 3, 3, 0, 0, 2, 5, 0, 0, 0, 3, 2, 0, 2, 3, 0, 0, 0, 0, 2, 0, 0, 0, 7, 0, 5, 5, 0, ... (sequence A046145 in the OEIS)

For prime n, they are

1, 2, 2, 3, 2, 2, 3, 2, 5, 2, 3, 2, 6, 3, 5, 2, 2, 2, 2, 7, 5, 3, 2, 3, 5, 2, 5, 2, 6, 3, 3, 2, 3, 2, 2, 6, 5, 2, 5, 2, 2, 2, 19, 5, 2, 3, 2, 3, 2, 6, 3, 7, 7, 6, 3, 5, 2, 6, 5, 3, 3, 2, 5, 17, 10, 2, 3, 10, 2, 2, 3, 7, 6, 2, 2, ... (sequence A001918 in the OEIS)

The largest primitive roots modulo n are

0, 1, 2, 3, 3, 5, 5, 0, 5, 7, 8, 0, 11, 5, 0, 0, 14, 11, 15, 0, 0, 19, 21, 0, 23, 19, 23, 0, 27, 0, 24, 0, 0, 31, 0, 0, 35, 33, 0, 0, 35, 0, 34, 0, 0, 43, 45, 0, 47, 47, 0, 0, 51, 47, 0, 0, 0, 55, 56, 0, 59, 55, 0, 0, 0, 0, 63, 0, 0, 0, 69, 0, 68, 69, 0, ... (sequence A046146 in the OEIS)

For prime n, they are

1, 2, 3, 5, 8, 11, 14, 15, 21, 27, 24, 35, 35, 34, 45, 51, 56, 59, 63, 69, 68, 77, 80, 86, 92, 99, 101, 104, 103, 110, 118, 128, 134, 135, 147, 146, 152, 159, 165, 171, 176, 179, 189, 188, 195, 197, 207, 214, 224, 223, ... (sequence A071894 in the OEIS)

Number of primitive roots modulo n are

1, 1, 1, 1, 2, 1, 2, 0, 2, 2, 4, 0, 4, 2, 0, 0, 8, 2, 6, 0, 0, 4, 10, 0, 8, 4, 6, 0, 12, 0, 8, 0, 0, 8, 0, 0, 12, 6, 0, 0, 16, 0, 12, 0, 0, 10, 22, 0, 12, 8, 0, 0, 24, 6, 0, 0, 0, 12, 28, 0, 16, 8, 0, 0, 0, 0, 20, 0, 0, 0, 24, 0, 24, 12, 0, ... (sequence A046144 in the OEIS)

For prime n, they are

1, 1, 2, 2, 4, 4, 8, 6, 10, 12, 8, 12, 16, 12, 22, 24, 28, 16, 20, 24, 24, 24, 40, 40, 32, 40, 32, 52, 36, 48, 36, 48, 64, 44, 72, 40, 48, 54, 82, 84, 88, 48, 72, 64, 84, 60, 48, 72, 112, 72, 112, 96, 64, 100, 128, 130, 132, 72, 88, 96, ... (sequence A008330 in the OEIS)

Smallest prime > n with primitive root n are

2, 3, 5, 0, 7, 11, 11, 11, 0, 17, 13, 17, 19, 17, 19, 0, 23, 29, 23, 23, 23, 31, 47, 31, 0, 29, 29, 41, 41, 41, 47, 37, 43, 41, 37, 0, 59, 47, 47, 47, 47, 59, 47, 47, 47, 67, 59, 53, 0, 53, ... (sequence A023049 in the OEIS)

Smallest prime (not necessarily exceeding n) with primitive root n are

2, 3, 2, 0, 2, 11, 2, 3, 2, 7, 2, 5, 2, 3, 2, 0, 2, 5, 2, 3, 2, 5, 2, 7, 2, 3, 2, 5, 2, 11, 2, 3, 2, 19, 2, 0, 2, 3, 2, 7, 2, 5, 2, 3, 2, 11, 2, 5, 2, 3, 2, 5, 2, 7, 2, 3, 2, 5, 2, 19, 2, 3, 2, 0, 2, 7, 2, 3, 2, 19, 2, 5, 2, 3, 2, ... (sequence A056619 in the OEIS)

Arithmetic facts

Gauss proved[6] that for any prime number p (with the sole exception of p = 3), the product of its primitive roots is congruent to 1 modulo p.

He also proved[7] that for any prime number p, the sum of its primitive roots is congruent to μ(p − 1) modulo p, where μ is the Möbius function.

For example,

p = 3, μ(2) = −1. The primitive root is 2.
p = 5, μ(4) = 0. The primitive roots are 2 and 3.
p = 7, μ(6) = 1. The primitive roots are 3 and 5.
p = 31, μ(30) = −1. The primitive roots are 3, 11, 12, 13, 17, 21, 22 and 24.
Their product 970377408 ≡ 1 (mod 31) and their sum 123 ≡ −1 (mod 31).
3 × 11 = 33 ≡ 2
12 × 13 = 156 ≡ 1
(−14) × (−10) = 140 ≡ 16
(−9) × (−7) = 63 ≡ 1, and 2 × 1 × 16 × 1 = 32 ≡ 1 (mod 31).

What about adding up elements of this multiplicative group? As it happens, sums (or differences) of two primitive roots add up to all elements of the index 2 subgroup of Z/n Z for even n, and to the whole group Z/n Z when n is odd:

Z/n Z× + Z/n Z× = Z/n Z or 2Z/n Z[8].

Finding primitive roots

No simple general formula to compute primitive roots modulo n is known.[9][10] There are however methods to locate a primitive root that are faster than simply trying out all candidates. If the multiplicative order of a number m modulo n is equal to (the order of Z×
n
), then it is a primitive root. In fact the converse is true: If m is a primitive root modulo n, then the multiplicative order of m is . We can use this to test a candidate m to see if it is primitive.

First, compute . Then determine the different prime factors of , say p1, ..., pk. Finally, compute

using a fast algorithm for modular exponentiation such as exponentiation by squaring. A number m for which these k results are all different from 1 is a primitive root.

The number of primitive roots modulo n, if there are any, is equal to[11]

since, in general, a cyclic group with r elements has generators. For prime n, this equals , and since the generators are very common among {2, …, n1} and thus it is relatively easy to find one.[12]

If g is a primitive root modulo p, then g is also a primitive root modulo all powers pk unless gp1 ≡ 1 (mod p2); in that case, g + p is.[13]

If g is a primitive root modulo pk, then either g or g + pk (whichever one is odd) is a primitive root modulo 2pk.[13]

Finding primitive roots modulo p is also equivalent to finding the roots of the (p1)th cyclotomic polynomial modulo p.

Order of magnitude of primitive roots

The least primitive root gp modulo p (in the range 1, 2, ..., p  1) is generally small.

Upper bounds

Burgess (1962) proved[14] that for every ε > 0 there is a C such that

Grosswald (1981) proved[14] that if , then .

Carella (2015) proved[15] that there is a such that for all sufficiently large primes .

Shoup (1990, 1992) proved,[16] assuming the generalized Riemann hypothesis, that gp = O(log6 p).

Lower bounds

Fridlander (1949) and Salié (1950) proved[14] that there is a positive constant C such that for infinitely many primes gp > C log p.

It can be proved[14] in an elementary manner that for any positive integer M there are infinitely many primes such that M < gp < p  M.

Applications

A primitive root modulo n is often used in cryptography, including the Diffie–Hellman key exchange scheme. Sound diffusers have been based on number-theoretic concepts such as primitive roots and quadratic residues.[17][18]

gollark: And pattern matching.
gollark: Rust would be better for this. It has ADTs.
gollark: Although I suppose its puny USB-OTG thing might not be happy with powering up my disk through an adapter.
gollark: In some sort of ridiculous emergency it's technically mountable from my spare phone (unlike NTFS, as the kernel on that is ancient).
gollark: You need special software to read the deduplicated/compressed/encrypted backup repositories off my disk *anyway*, so using a slightly less well supported filesystem is not a concern.

See also

Notes

  1. "Archived copy". Archived from the original on 2017-07-03. Retrieved 2017-07-03.CS1 maint: archived copy as title (link)
  2. Weisstein, Eric W. "Modulo Multiplication Group". MathWorld.
  3. Primitive root, Encyclopedia of Mathematics.
  4. Vinogradov 2003, pp. 105–121, § VI PRIMITIVE ROOTS AND INDICES.
  5. Vinogradov 2003, p. 106.
  6. Gauss & Clarke 1986, arts. 80.
  7. Gauss & Clarke 1986, arts. 81.
  8. Emmanuel Amiot, Music Through Fourier Space, p. 38 (Springer, CMS Series, 2016).
  9. von zur Gathen & Shparlinski 1998, pp. 15–24: "One of the most important unsolved problems in the theory of finite fields is designing a fast algorithm to construct primitive roots."
  10. Robbins 2006, p. 159: "There is no convenient formula for computing [the least primitive root]."
  11. (sequence A010554 in the OEIS)
  12. Donald E. Knuth, The Art of Computer Programming, vol. 2: Seminumerical Algorithms, 3rd edition, section 4.5.4, p. 391 (Addison–Wesley, 1998).
  13. Cohen 1993, p. 26.
  14. Ribenboim 1996, p. 24.
  15. Carella, N. A. (2015). "Least Prime Primitive Roots". International Journal of Mathematics and Computer Science. 10 (2): 185–194. arXiv:1709.01172.
  16. Bach & Shallit 1996, p. 254.
  17. Walker, R. "The design and application of modular acoustic diffusing elements" (PDF). BBC Research Department. Retrieved 25 March 2019.
  18. Feldman, Eliot (July 1995). "A reflection grating that nullifies the specular reflection: A cone of silence". J. Acoust. Soc. Am. 98 (1): 623–634. Bibcode:1995ASAJ...98..623F. doi:10.1121/1.413656.

References

The Disquisitiones Arithmeticae has been translated from Gauss's Ciceronian Latin into English and German. The German edition includes all of his papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes.

  • Amiot, Emmanuel (2016), Music Through Fourier Space, Zürich: Springer, ISBN 978-3-319-45581-5.
  • Bach, Eric; Shallit, Jeffrey (1996), Algorithmic Number Theory (Vol I: Efficient Algorithms), Cambridge: The MIT Press, ISBN 978-0-262-02405-1.
  • Carella, N. A. (2015), "Least Prime Primitive Roots", International Journal of Mathematics and Computer Science, 10 (2): 185–194, arXiv:1709.01172.
  • Cohen, Henri (1993), A Course in Computational Algebraic Number Theory, Berlin: Springer, ISBN 978-3-540-55640-4.
  • Gauss, Carl Friedrich; Clarke, Arthur A. (translator) (1986), Disquisitiones Arithmeticae (2nd, corrected ed.), New York: Springer, ISBN 978-0-387-96254-2 [in English].
  • Gauss, Carl Friedrich; Maser, H. (translator) (1965), Untersuchungen über höhere Arithmetik [Studies on higher arithmetic] (2nd ed.), New York: Chelsea, ISBN 978-0-8284-0191-3 [in German].
  • Ribenboim, Paulo (1996), The New Book of Prime Number Records, New York: Springer, ISBN 978-0-387-94457-9.
  • Robbins, Neville (2006), Beginning Number Theory, Jones & Bartlett Learning, ISBN 978-0-7637-3768-9.
  • Vinogradov, I. M. (2003), "§ VI PRIMITIVE ROOTS AND INDICES", Elements of Number Theory, Mineola, NY: Dover Publications, pp. 105–121, ISBN 978-0-486-49530-9.
  • von zur Gathen, Joachim; Shparlinski, Igor (1998), "Orders of Gauss periods in finite fields", Applicable Algebra in Engineering, Communication and Computing, 9 (1): 15–24, CiteSeerX 10.1.1.46.5504, doi:10.1007/s002000050093, MR 1624824.

Further reading

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.