<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki1463/index.php?action=history&amp;feed=atom&amp;title=Primitive_root_modulo_n</id>
	<title>Primitive root modulo n - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki1463/index.php?action=history&amp;feed=atom&amp;title=Primitive_root_modulo_n"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki1463/index.php?title=Primitive_root_modulo_n&amp;action=history"/>
	<updated>2026-12-01T13:30:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.3</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki1463/index.php?title=Primitive_root_modulo_n&amp;diff=132207&amp;oldid=prev</id>
		<title>imported&gt;Athina241: /* Table of primitive roots */</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki1463/index.php?title=Primitive_root_modulo_n&amp;diff=132207&amp;oldid=prev"/>
		<updated>2026-10-05T12:31:54Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Table of primitive roots&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Modular arithmetic concept}}&lt;br /&gt;
{{DISPLAYTITLE:Primitive root modulo {{mvar|n}}}}&lt;br /&gt;
In [[number theory]], a number {{mvar|g}} is a &amp;#039;&amp;#039;&amp;#039;primitive root modulo&amp;amp;nbsp;{{mvar|n}}&amp;#039;&amp;#039;&amp;#039; if every number {{mvar|a}} [[coprime]] to {{mvar|n}} is [[modular arithmetic|congruent]] to a power of {{mvar|g}} [[modulo]] {{mvar|n}}. In symbols, {{mvar|g}} is a primitive root modulo&amp;amp;nbsp;{{mvar|n}} if for every integer {{mvar|a}} coprime to {{mvar|n}}, there is some integer {{mvar|k}} for which {{math|&amp;#039;&amp;#039;g&amp;#039;&amp;#039;&amp;lt;sup&amp;gt;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;lt;/sup&amp;gt; ≡ &amp;#039;&amp;#039;a&amp;#039;&amp;#039; (mod&amp;amp;nbsp;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;)}}.  &lt;br /&gt;
&lt;br /&gt;
Primitive roots only exist for some integers {{mvar|n}}.  Specifically, a primitive root exists modulo {{mvar|n}} if and only if {{mvar|n}} is 4, {{math|&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;lt;sup&amp;gt;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;lt;/sup&amp;gt;}} or {{math|2&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;lt;sup&amp;gt;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;lt;/sup&amp;gt;}} for some odd [[prime number]] {{mvar|p}} and some {{math|&amp;#039;&amp;#039;k&amp;#039;&amp;#039; ≥ 0}}.&amp;lt;ref&amp;gt;{{MathWorld|title=Modulo Multiplication Group|urlname=ModuloMultiplicationGroup}}  &amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;:0&amp;quot;&amp;gt;{{Cite web |title=Primitive root - Encyclopedia of Mathematics |url=https://encyclopediaofmath.org:443/wiki/Primitive_root |access-date=2024-11-05 |website=encyclopediaofmath.org}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;Vinogradov2003.pp=105-121&amp;quot;&amp;gt;{{Harv|Vinogradov|2003|loc=§ VI PRIMITIVE ROOTS AND INDICES|pp=105–121}}&amp;lt;/ref&amp;gt;  This was first proved by [[Carl Friedrich Gauss]].&amp;lt;ref&amp;gt;{{Harv|Gauss|1986|loc=arts. 52–56, 82–891}}&amp;lt;/ref&amp;gt;  Gauss defined primitive roots in Article 57 of his &amp;#039;&amp;#039;[[Disquisitiones Arithmeticae]]&amp;#039;&amp;#039; (1801), where he credited [[Leonhard Euler]] with coining the term. In Article 56 he stated that [[Johann Heinrich Lambert]] and Euler knew of them, but he was the first to rigorously demonstrate that primitive roots exist for a prime number {{mvar|n}}. In fact, the &amp;#039;&amp;#039;Disquisitiones&amp;#039;&amp;#039; contains two proofs: The one in Article 54 is a nonconstructive [[Existence theorem|existence proof]], while the proof in Article 55 is [[Constructive proof|constructive]].&lt;br /&gt;
&lt;br /&gt;
An equivalent characterization is that {{mvar|g}} is a primitive root modulo&amp;amp;nbsp;{{mvar|n}} if and only if {{mvar|g}} is a [[Generating_set_of_a_group|generator]] of the [[multiplicative group of integers modulo n|multiplicative group of integers modulo {{mvar|n}}]].  Thus, primitive roots exist if and only if this group is a [[cyclic group]].&lt;br /&gt;
&lt;br /&gt;
If {{mvar|g}} is a primitive root modulo {{mvar|n}} and {{math|&amp;#039;&amp;#039;g&amp;#039;&amp;#039;&amp;lt;sup&amp;gt;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;lt;/sup&amp;gt; ≡ &amp;#039;&amp;#039;a&amp;#039;&amp;#039; (mod&amp;amp;nbsp;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;)}}, then the value {{mvar|k}} is called the &amp;#039;&amp;#039;index&amp;#039;&amp;#039; or &amp;#039;&amp;#039;[[discrete logarithm]]&amp;#039;&amp;#039; of {{mvar|a}} to the base {{mvar|g}} modulo {{mvar|n}}.&lt;br /&gt;
&lt;br /&gt;
==Elementary example==&lt;br /&gt;
The number 3 is a primitive root modulo&amp;amp;nbsp;7&amp;lt;ref&amp;gt;{{cite web |last=Stromquist |first=Walter |title=What are primitive roots? |publisher=Bryn Mawr College |department=Mathematics |url=http://www.brynmawr.edu/math/people/stromquist/numbers/primitive.html |access-date=2017-07-03 |archive-url=https://web.archive.org/web/20170703173446/http://www.brynmawr.edu/math/people/stromquist/numbers/primitive.html |archive-date=2017-07-03}}&amp;lt;/ref&amp;gt; because&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{array}{rcrcrcrcrcr}&lt;br /&gt;
3^1 &amp;amp;=&amp;amp; 3^0 \times 3 &amp;amp;\equiv&amp;amp; 1 \times 3 &amp;amp;=&amp;amp;  3 &amp;amp;\equiv&amp;amp; 3 \pmod 7 \\&lt;br /&gt;
3^2 &amp;amp;=&amp;amp; 3^1 \times 3 &amp;amp;\equiv&amp;amp; 3 \times 3 &amp;amp;=&amp;amp;  9 &amp;amp;\equiv&amp;amp; 2 \pmod 7 \\&lt;br /&gt;
3^3 &amp;amp;=&amp;amp; 3^2 \times 3 &amp;amp;\equiv&amp;amp; 2 \times 3 &amp;amp;=&amp;amp;  6 &amp;amp;\equiv&amp;amp; 6 \pmod 7 \\&lt;br /&gt;
3^4 &amp;amp;=&amp;amp; 3^3 \times 3 &amp;amp;\equiv&amp;amp; 6 \times 3 &amp;amp;=&amp;amp; 18 &amp;amp;\equiv&amp;amp; 4 \pmod 7 \\&lt;br /&gt;
3^5 &amp;amp;=&amp;amp; 3^4 \times 3 &amp;amp;\equiv&amp;amp; 4 \times 3 &amp;amp;=&amp;amp; 12 &amp;amp;\equiv&amp;amp; 5 \pmod 7 \\&lt;br /&gt;
3^6 &amp;amp;=&amp;amp; 3^5 \times 3 &amp;amp;\equiv&amp;amp; 5 \times 3 &amp;amp;=&amp;amp; 15 &amp;amp;\equiv&amp;amp; 1 \pmod 7&lt;br /&gt;
\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
The remainders 3, 2, 6, 4, 5, 1 include each [[congruence class]] relatively prime to 7.  Higher powers repeat the same pattern [[periodic function|periodically]].&lt;br /&gt;
&lt;br /&gt;
The number of congruence classes relatively prime to the modulus {{mvar|n}} is given by [[Euler&amp;#039;s totient function]] {{mvar|φ}} applied to {{mvar|n}}.  In this case, that is {{math|&amp;#039;&amp;#039;φ&amp;#039;&amp;#039;(7) {{=}} 6}}.  For a prime modulus {{mvar|n}}, this period is always equal to {{math|&amp;#039;&amp;#039;n&amp;#039;&amp;#039; − 1}}, but this is not true for [[composite number|composite]] {{mvar|n}}.&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
If {{mvar|n}} is a positive integer, the integers from 1 to {{nowrap|{{mvar|n}} − 1}} that are [[coprime]] to {{mvar|n}} (or equivalently, the [[congruence class]]es coprime to {{mvar|n}}) form a [[group (mathematics)|group]], with multiplication [[Modular arithmetic|modulo]] {{mvar|n}} as the operation; it is denoted by &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt;, and is called the [[group of units]] modulo {{mvar|n}}, or the group of primitive classes modulo {{mvar|n}}. As explained in the article [[multiplicative group of integers modulo n|multiplicative group of integers modulo {{mvar|n}}]], this multiplicative group &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt; is [[cyclic group|cyclic]] if and only if {{mvar|n}} is equal to 2, 4, {{mvar|p{{sup|k}}}}, or {{math|2&amp;#039;&amp;#039;p{{sup|k}}&amp;#039;&amp;#039;}} where {{mvar|p{{sup|k}}}} is a power of an odd [[prime number]].&amp;lt;ref&amp;gt;{{MathWorld |title=Modulo Multiplication Group |urlname=ModuloMultiplicationGroup}}&lt;br /&gt;
&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;:0&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;Vinogradov2003.pp=105–121&amp;quot;&amp;gt;{{Harvnb|Vinogradov|2003|loc=§ VI Primitive roots and indices|pp=105–121}}.&amp;lt;/ref&amp;gt; When (and only when) this group &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt; is cyclic, a [[generating set of a group|generator]] of this cyclic group is called a &amp;#039;&amp;#039;primitive root modulo&amp;#039;&amp;#039; {{mvar|n}}&amp;lt;ref&amp;gt;{{Harvnb|Vinogradov|2003|p=106}}.&amp;lt;/ref&amp;gt; (or in fuller language &amp;#039;&amp;#039;primitive root of unity modulo {{mvar|n}}&amp;#039;&amp;#039;, emphasizing its role as a fundamental solution of the &amp;#039;&amp;#039;&amp;#039;[[Root of unity modulo n|roots of unity]]&amp;#039;&amp;#039;&amp;#039; polynomial equations X{{su|p={{mvar|m}}}} − 1 in the ring &amp;lt;math&amp;gt;\mathbb{Z}_n&amp;lt;/math&amp;gt;), or simply a &amp;#039;&amp;#039;&amp;#039;primitive element of&amp;#039;&amp;#039;&amp;#039; &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt; is non-cyclic, such primitive elements mod {{mvar|n}} do not exist. Instead, each prime component of {{mvar|n}} has its own sub-primitive roots (see {{math|15}} in the examples below).&lt;br /&gt;
&lt;br /&gt;
For any {{mvar|n}} (whether or not &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt; is cyclic), the order of &amp;lt;math&amp;gt;\mathbb{Z}_n^\times&amp;lt;/math&amp;gt; is given by [[Euler&amp;#039;s totient function]] {{mvar|φ}}({{mvar|n}}) {{OEIS|id=A000010}}. And then, [[Euler&amp;#039;s theorem]] says that {{nowrap|{{mvar|a}}&amp;lt;sup&amp;gt;{{mvar|φ}}({{mvar|n}})&amp;lt;/sup&amp;gt; ≡ 1 (mod {{mvar|n}})}} for every {{mvar|a}} coprime to {{mvar|n}}; the lowest power of {{mvar|a}} that is congruent to 1 modulo {{mvar|n}} is called the [[multiplicative order]] of {{mvar|a}} modulo {{mvar|n}}. In particular, for {{mvar|a}} to be a primitive root modulo {{mvar|n}}, {{nowrap|{{mvar|φ}}({{mvar|n}})}} has to be the smallest power of {{mvar|a}} satisfying {{nowrap|{{mvar|a}}&amp;lt;sup&amp;gt;{{mvar|x}}&amp;lt;/sup&amp;gt; ≡ 1 (mod {{mvar|n}})}} .&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
For example, if {{nowrap|{{mvar|n}} {{=}} 14}} then the elements of &amp;lt;math&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt;{{su|b={{mvar|n}}|p=×}} are the congruence classes {1, 3, 5, 9, 11, 13}; there are {{nowrap|{{mvar|φ}}(14) {{=}} 6}} of them. Here is a table of their powers modulo 14:&lt;br /&gt;
&lt;br /&gt;
  x     x, x&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;, x&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, ... (mod 14)&lt;br /&gt;
  1 :   1&lt;br /&gt;
  3 :   3,  9, 13, 11,  5,  1 &lt;br /&gt;
  5 :   5, 11, 13,  9,  3,  1&lt;br /&gt;
  9 :   9, 11,  1&lt;br /&gt;
 11 :  11,  9,  1&lt;br /&gt;
 13 :  13,  1&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
For a second example let {{nowrap|{{mvar|n}} {{=}} 15 .}} The elements of &amp;lt;math&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt;{{su|b=15|p=×}} are the congruence classes {1, 2, 4, 7, 8, 11, 13, 14}; there are {{nowrap|{{mvar|φ}}(15) {{=}} 8}} of them.&lt;br /&gt;
&lt;br /&gt;
  x     x, x&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;, x&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;, ... (mod 15)&lt;br /&gt;
  1 :   1&lt;br /&gt;
  2 :   2,  4,  8, 1 &lt;br /&gt;
  4 :   4,  1&lt;br /&gt;
  7 :   7,  4, 13, 1&lt;br /&gt;
  8 :   8,  4,  2, 1&lt;br /&gt;
 11 :  11,  1&lt;br /&gt;
 13 :  13,  4,  7, 1&lt;br /&gt;
 14 :  14,  1&lt;br /&gt;
&lt;br /&gt;
Since there is no number whose order is 8, there are no primitive roots modulo 15. Indeed, {{nowrap|{{mvar|λ}}(15) {{=}} 4}}, where {{mvar|λ}} is the [[Carmichael function]]. {{OEIS|id=A002322}}&lt;br /&gt;
&lt;br /&gt;
==Table of primitive roots==&lt;br /&gt;
&lt;br /&gt;
Numbers &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; that have a primitive root are of the form&lt;br /&gt;
:&amp;lt;math&amp;gt;n \in \{1, 2, 4, p^k, 2 \cdot p^k \; \; | \; \; 2 &amp;lt; p \text{ prime}; \; k \in \mathbb{N}\} ,&amp;lt;/math&amp;gt;&lt;br /&gt;
:= {1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 17, 18, 19, ...}.&amp;lt;ref&amp;gt;{{Harvnb|Gauss|1986|loc=art 92}}.&amp;lt;/ref&amp;gt;&lt;br /&gt;
These are the numbers &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\varphi(n) = \lambda(n),&amp;lt;/math&amp;gt; kept also in the sequence {{OEIS link|id=A033948}} in the [[OEIS]].&lt;br /&gt;
&lt;br /&gt;
The following table lists the primitive roots modulo {{mvar|n}} up to &amp;lt;math&amp;gt;n=50&amp;lt;/math&amp;gt;:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!{{tmath|n}}&lt;br /&gt;
!primitive roots modulo {{tmath|n}}&lt;br /&gt;
!order &amp;lt;math&amp;gt;\varphi(n),&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;({{oeis|id=A000010}})&lt;br /&gt;
![[Torsion group|exponent]] &amp;lt;math&amp;gt;\lambda(n),&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;({{oeis|id=A002322}})&lt;br /&gt;
|-&lt;br /&gt;
|1||0||1||1&lt;br /&gt;
|-&lt;br /&gt;
|2||1||1||1&lt;br /&gt;
|-&lt;br /&gt;
|3||2||2||2&lt;br /&gt;
|-&lt;br /&gt;
|4||3||2||2&lt;br /&gt;
|-&lt;br /&gt;
|5||2, 3||4||4&lt;br /&gt;
|-&lt;br /&gt;
|6||5||2||2&lt;br /&gt;
|-&lt;br /&gt;
|7||3, 5||6||6&lt;br /&gt;
|-&lt;br /&gt;
|8|| ||4||2&lt;br /&gt;
|-&lt;br /&gt;
|9||2, 5||6||6&lt;br /&gt;
|-&lt;br /&gt;
|10||3, 7||4||4&lt;br /&gt;
|-&lt;br /&gt;
|11||2, 6, 7, 8||10||10&lt;br /&gt;
|-&lt;br /&gt;
|12|| ||4||2&lt;br /&gt;
|-&lt;br /&gt;
|13||2, 6, 7, 11||12||12&lt;br /&gt;
|-&lt;br /&gt;
|14||3, 5||6||6&lt;br /&gt;
|-&lt;br /&gt;
|15|| ||8||4&lt;br /&gt;
|-&lt;br /&gt;
|16|| ||8||4&lt;br /&gt;
|-&lt;br /&gt;
|17||3, 5, 6, 7, 10, 11, 12, 14||16||16&lt;br /&gt;
|-&lt;br /&gt;
|18||5, 11||6||6&lt;br /&gt;
|-&lt;br /&gt;
|19||2, 3, 10, 13, 14, 15||18||18&lt;br /&gt;
|-&lt;br /&gt;
|20|| ||8||4&lt;br /&gt;
|-&lt;br /&gt;
|21|| ||12||6&lt;br /&gt;
|-&lt;br /&gt;
|22||7, 13, 17, 19||10||10&lt;br /&gt;
|-&lt;br /&gt;
|23||5, 7, 10, 11, 14, 15, 17, 19, 20, 21||22||22&lt;br /&gt;
|-&lt;br /&gt;
|24|| ||8||2&lt;br /&gt;
|-&lt;br /&gt;
|25||2, 3, 8, 12, 13, 17, 22, 23||20||20&lt;br /&gt;
|-&lt;br /&gt;
|26||7, 11, 15, 19||12||12&lt;br /&gt;
|-&lt;br /&gt;
|27||2, 5, 11, 14, 20, 23||18||18&lt;br /&gt;
|-&lt;br /&gt;
|28|| ||12||6&lt;br /&gt;
|-&lt;br /&gt;
|29||2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26, 27||28||28&lt;br /&gt;
|-&lt;br /&gt;
|30|| ||8||4&lt;br /&gt;
|-&lt;br /&gt;
|31||3, 11, 12, 13, 17, 21, 22, 24||30||30&lt;br /&gt;
|-&lt;br /&gt;
|32|| ||16||8&lt;br /&gt;
|-&lt;br /&gt;
|33|| ||20||10&lt;br /&gt;
|-&lt;br /&gt;
|34||3, 5, 7, 11, 23, 27, 29, 31||16||16&lt;br /&gt;
|-&lt;br /&gt;
|35|| ||24||12&lt;br /&gt;
|-&lt;br /&gt;
|36|| ||12||6&lt;br /&gt;
|-&lt;br /&gt;
|37||2, 5, 13, 15, 17, 18, 19, 20, 22, 24, 32, 35||36||36&lt;br /&gt;
|-&lt;br /&gt;
|38||3, 13, 15, 21, 29, 33||18||18&lt;br /&gt;
|-&lt;br /&gt;
|39|| ||24||12&lt;br /&gt;
|-&lt;br /&gt;
|40|| ||16||8&lt;br /&gt;
|-&lt;br /&gt;
|41||6, 7, 11, 12, 13, 15, 17, 19, 22, 24, 26, 28, 29, 30, 34, 35||40||40&lt;br /&gt;
|-&lt;br /&gt;
|42|| ||12||6&lt;br /&gt;
|-&lt;br /&gt;
|43||3, 5, 12, 18, 19, 20, 26, 28, 29, 30, 33, 34||42||42&lt;br /&gt;
|-&lt;br /&gt;
|44|| ||20||10&lt;br /&gt;
|-&lt;br /&gt;
|45|| ||24||12&lt;br /&gt;
|-&lt;br /&gt;
|46||5, 7, 11, 15, 17, 19, 21, 33, 37, 43||22||22&lt;br /&gt;
|-&lt;br /&gt;
|47||5, 10, 11, 13, 15, 19, 20, 22, 23, 26, 29, 30, 31, 33, 35, 38, 39, 40, 41, 43, 44, 45||46||46&lt;br /&gt;
|-&lt;br /&gt;
|48|| ||16||4&lt;br /&gt;
|-&lt;br /&gt;
|49||3, 5, 10, 12, 17, 24, 26, 33, 38, 40, 45, 47||42||42&lt;br /&gt;
|-&lt;br /&gt;
|50||3, 13, 17, 23, 27, 33, 37, 47||20||20&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
&lt;br /&gt;
Gauss proved&amp;lt;ref&amp;gt;{{Harvnb|Gauss|1986|loc=arts. 80}}.&amp;lt;/ref&amp;gt; that for any prime number {{mvar|p}} (with the sole exception of {{nowrap|{{mvar|p}} {{=}} 3),}} the product of its primitive roots is congruent to 1 modulo {{mvar|p}}.&lt;br /&gt;
&lt;br /&gt;
He also proved&amp;lt;ref&amp;gt;{{Harvnb|Gauss|1986|loc=art 81}}.&amp;lt;/ref&amp;gt; that for any prime number {{mvar|p}}, the sum of its primitive roots is congruent to {{mvar|μ}}({{mvar|p}} − 1) modulo {{mvar|p}}, where {{mvar|μ}} is the [[Möbius function]].&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
:{|&lt;br /&gt;
|-&lt;br /&gt;
|{{mvar|p}} = 3, || {{mvar|μ}}(2) = −1. || The primitive root is 2.&lt;br /&gt;
|-&lt;br /&gt;
|{{mvar|p}} = 5, || {{mvar|μ}}(4) = 0. || The primitive roots are 2 and 3.&lt;br /&gt;
|-&lt;br /&gt;
|{{mvar|p}} = 7, || {{mvar|μ}}(6) = 1. || The primitive roots are 3 and 5.&lt;br /&gt;
|-&lt;br /&gt;
|{{mvar|p}} = 31, ||{{mvar|μ}}(30) = −1. || The primitive roots are 3, 11, 12, 13, 17, 21, 22 and 24.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
E.g., the product of the latter primitive roots is &amp;lt;math&amp;gt;2^6\cdot 3^4\cdot 7\cdot 11^2\cdot 13\cdot 17 = 970377408 \equiv 1 \pmod{31}&amp;lt;/math&amp;gt;, and their sum is &amp;lt;math&amp;gt;123 \equiv -1 \equiv \mu(31-1) \pmod{31}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is a primitive root modulo the prime &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;a^\frac{p-1}{2}\equiv -1 \pmod p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Artin&amp;#039;s conjecture on primitive roots]] states that a given integer {{mvar|a}} that is neither a [[Square number|perfect square]] nor &amp;amp;minus;1 is a primitive root modulo infinitely many [[prime number|primes]].&lt;br /&gt;
&lt;br /&gt;
==Finding primitive roots==&lt;br /&gt;
&lt;br /&gt;
No simple general formula to compute primitive roots modulo {{mvar|n}} is known.{{efn|&amp;quot;One of the most important unsolved problems in the theory of finite fields is designing a fast algorithm to construct primitive roots. {{Harvnb|von zur Gathen|Shparlinski|1998|pp=15–24}} }}{{efn|&amp;quot;There is no convenient formula for computing [the least primitive root].&amp;quot; {{Harvnb|Robbins|2006|p=159}} }} There are however methods to locate a primitive root that are faster than simply trying out all candidates. If the [[multiplicative order]] (its [[Torsion group|exponent]]) of a number {{mvar|m}} modulo {{mvar|n}} is equal to [[Euler&amp;#039;s phi function|&amp;lt;math&amp;gt;\varphi(n)&amp;lt;/math&amp;gt;]] (the order of &amp;lt;math&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt;{{su|b={{mvar|n}}|p=×}}), then it is a primitive root. In fact the converse is true: If {{mvar|m}} is a primitive root modulo {{mvar|n}}, then the multiplicative order of {{mvar|m}} is &amp;lt;math&amp;gt;\varphi(n) = \lambda(n)~.&amp;lt;/math&amp;gt; We can use this to test a candidate {{mvar|m}} to see if it is primitive.&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;math&amp;gt;n &amp;gt; 1&amp;lt;/math&amp;gt; first, compute &amp;lt;math&amp;gt;\varphi(n)~.&amp;lt;/math&amp;gt; Then determine the different [[prime factor]]s of &amp;lt;math&amp;gt;\varphi(n)&amp;lt;/math&amp;gt;, say {{mvar|p}}&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, ..., {{mvar|p{{sub|k}}}}. Finally, compute&lt;br /&gt;
:&amp;lt;math&amp;gt;g^{\varphi(n)/p_i}\bmod n \qquad\mbox{ for } i=1,\ldots,k&amp;lt;/math&amp;gt;&lt;br /&gt;
using a fast algorithm for [[modular exponentiation]] such as [[exponentiation by squaring]]. A number {{mvar|g}} for which these {{mvar|k}} results are all different from 1 is a primitive root.&lt;br /&gt;
&lt;br /&gt;
The number of primitive roots modulo {{mvar|n}}, if there are any, is equal to&amp;lt;ref&amp;gt;{{OEIS|A010554}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\varphi\left(\varphi(n)\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
since, in general, a cyclic group with {{mvar|r}} elements has &amp;lt;math&amp;gt;\varphi(r)&amp;lt;/math&amp;gt; generators.&lt;br /&gt;
&lt;br /&gt;
For prime {{mvar|n}}, this equals &amp;lt;math&amp;gt;\varphi(n-1)&amp;lt;/math&amp;gt;, and since &amp;lt;math&amp;gt;n / \varphi(n-1) \in O(\log\log n)&amp;lt;/math&amp;gt; the generators are very common among {2, ..., {{mvar|n}}&amp;amp;minus;1} and thus it is relatively easy to find one.&amp;lt;ref name=Knuth-1998/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If {{mvar|g}} is a primitive root modulo {{mvar|p}}, then {{mvar|g}} is also a primitive root modulo all powers {{mvar|p{{sup|k}}}} unless {{mvar|g}}&amp;lt;sup&amp;gt;{{mvar|p}}−1&amp;lt;/sup&amp;gt; ≡ 1 (mod {{mvar|p}}&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;); in that case, {{mvar|g}} + {{mvar|p}} is.&amp;lt;ref name=&amp;quot;Cohen1993&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If {{mvar|g}} is a primitive root modulo {{mvar|p{{sup|k}}}}, then {{mvar|g}} is also a primitive root modulo all smaller powers of {{mvar|p}}.&lt;br /&gt;
&lt;br /&gt;
If {{mvar|g}} is a primitive root modulo {{mvar|p{{sup|k}}}}, then either {{mvar|g}} or {{mvar|g}} + {{mvar|p{{sup|k}}}} (whichever one is odd) is a primitive root modulo 2{{mvar|p{{sup|k}}}}.&amp;lt;ref name=&amp;quot;Cohen1993&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finding primitive roots modulo {{mvar|p}} is also equivalent to finding the roots of the ({{mvar|p}} − 1)st [[cyclotomic polynomial]] modulo {{mvar|p}}.&lt;br /&gt;
&lt;br /&gt;
==Order of magnitude of primitive roots==&lt;br /&gt;
&lt;br /&gt;
The least primitive root {{mvar|g{{sub|p}}}} modulo {{mvar|p}} (in the range 1, 2, ..., {{nowrap|{{mvar|p}} − 1)}} is generally small.&lt;br /&gt;
&lt;br /&gt;
===Upper bounds===&lt;br /&gt;
Burgess (1962) proved&amp;lt;ref name=&amp;quot;Ribenboim, p.24&amp;quot;/&amp;gt;&amp;lt;ref&amp;gt;{{Cite journal |last=Burgess |first=D. A. |date=1962 |title=On Character Sums and Primitive Roots † |url=http://doi.wiley.com/10.1112/plms/s3-12.1.179 |journal=[[Proceedings of the London Mathematical Society]] |language=en |volume=s3-12 |issue=1 |pages=179–192 |doi=10.1112/plms/s3-12.1.179|url-access=subscription }}&amp;lt;/ref&amp;gt; that for every &amp;#039;&amp;#039;ε&amp;#039;&amp;#039; &amp;gt; 0 there is a {{mvar|C}} such that &amp;lt;math&amp;gt;g_p \leq C\,p^{\frac{1}{4}+\varepsilon}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Emil Grosswald|Grosswald]] (1981) proved&amp;lt;ref name=&amp;quot;Ribenboim, p.24&amp;quot;/&amp;gt;&amp;lt;ref&amp;gt;{{Cite journal |last=Grosswald |first=E. |date=1981 |title=On Burgess&amp;#039; Bound for Primitive Roots Modulo Primes and an Application to Γ(p) |journal=[[American Journal of Mathematics]] |volume=103 |issue=6 |pages=1171–1183 |doi=10.2307/2374229 |jstor=2374229 |issn=0002-9327}}&amp;lt;/ref&amp;gt; that if &amp;lt;math&amp;gt;p &amp;gt; e^{e^{24}} \approx 10^{11504079571}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;g_p &amp;lt; p^{0.499}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Victor Shoup|Shoup]] (1990, 1992) proved,&amp;lt;ref&amp;gt;{{Harvnb|Bach|Shallit|1996|p=254}}.&amp;lt;/ref&amp;gt; assuming the [[generalized Riemann hypothesis]], that {{nowrap|{{mvar|g{{sub|p}}}} {{=}} O(log&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt; {{mvar|p}}).}}&lt;br /&gt;
&lt;br /&gt;
===Lower bounds===&lt;br /&gt;
Fridlander (1949) and Salié (1950) proved&amp;lt;ref name=&amp;quot;Ribenboim, p.24&amp;quot;/&amp;gt; that there is a positive constant {{mvar|C}} such that for infinitely many primes {{nowrap|{{mvar|g{{sub|p}}}} &amp;gt; {{mvar|C}} log {{mvar|p}}.}}&lt;br /&gt;
&lt;br /&gt;
It can be proved&amp;lt;ref name=&amp;quot;Ribenboim, p.24&amp;quot;/&amp;gt; in an elementary manner that for any positive integer {{mvar|M}} there are infinitely many primes such that {{mvar|M}} &amp;lt; {{mvar|g{{sub|p}}}} &amp;lt; {{nowrap|{{mvar|p}} − {{mvar|M}}.}}&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
A primitive root modulo {{mvar|n}} is often used in [[Pseudorandom number generator|pseudorandom number generators]]&amp;lt;ref&amp;gt;{{Cite book |last=Gentle |first=James E. |title=Random number generation and Monte Carlo methods |date=2003 |publisher=Springer |isbn=0-387-00178-6 |edition=2nd |location=New York |oclc=51534945}}&amp;lt;/ref&amp;gt; and [[cryptography]], including the [[Diffie–Hellman key exchange]] scheme. [[Diffusion (acoustics)#Primitive-root diffusors|Sound diffusers]] have been based on number-theoretic concepts such as primitive roots and [[Quadratic residue|quadratic residues]].&amp;lt;ref name=Walker-1990/&amp;gt;&amp;lt;ref name=Feldman/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Div col}}&lt;br /&gt;
* [[Artin&amp;#039;s conjecture on primitive roots]]&lt;br /&gt;
* [[Dirichlet character]]&lt;br /&gt;
* [[Full reptend prime]]&lt;br /&gt;
* [[Multiplicative order]]&lt;br /&gt;
* [[Quadratic residue]]&lt;br /&gt;
* [[Root of unity modulo n|Root of unity modulo {{mvar|n}}]]&lt;br /&gt;
* [[Welch–Costas array]]&lt;br /&gt;
* [[Wilson&amp;#039;s theorem#Gauss.27s generalization|Gauss&amp;#039;s generalization of Wilson&amp;#039;s theorem]]&lt;br /&gt;
{{Div col end}}&lt;br /&gt;
&lt;br /&gt;
==Footnotes==&lt;br /&gt;
{{notelist|1}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;!--&amp;lt;ref name=&amp;quot;Carella-2015&amp;quot;&amp;gt;{{cite journal|title=Least Prime Primitive Roots|last1=Carella|first1=N.A.|year=2015|journal=International Journal of Mathematics and Computer Science|volume=10|issue=2|pages=185–194|arxiv=1709.01172}}&amp;lt;/ref&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cohen1993&amp;quot;&amp;gt;{{cite book | last1 = Cohen | first1 = Henri | author-link = Henri Cohen (number theorist) | year = 1993 | title = A Course in Computational Algebraic Number Theory | page = 26 | publisher = [[Springer Science+Business Media|Springer]] | location = Berlin | isbn = 978-3-540-55640-4}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Feldman&amp;quot;&amp;gt;{{cite journal |first = Eliot |last = Feldman |date = July 1995 |title = A reflection grating that nullifies the specular reflection: A cone of silence |journal = J. Acoust. Soc. Am. |volume = 98 |issue = 1 |pages = 623–634 |doi = 10.1121/1.413656 |bibcode = 1995ASAJ...98..623F}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Knuth-1998&amp;quot;&amp;gt;{{cite book | first = Donald E. | last = Knuth |author-link=Donald Knuth | year = 1998 | title = Seminumerical Algorithms | edition = 3rd | at = section&amp;amp;nbsp;4.5.4, page&amp;amp;nbsp;391 | series = The Art of Computer Programming | volume= 2 | publisher = Addison–Wesley}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Ribenboim, p.24&amp;quot;&amp;gt;{{cite book | last = Ribenboim | first = Paulo | author-link = Paulo Ribenboim | year = 1996 | title = The New Book of Prime Number Records | page = 24 | publisher = [[Springer Science+Business Media|Springer]] | location = New York, NY | isbn = 978-0-387-94457-9}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Walker-1990&amp;quot;&amp;gt;{{cite report |last=Walker |first=R. |year=1990 |title=The design and application of modular acoustic diffusing elements |url=https://downloads.bbc.co.uk/rd/pubs/reports/1990-15.pdf |department=BBC Research Department |publisher=[[British Broadcasting Corporation]] |access-date=25 March 2019}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sources==&lt;br /&gt;
{{refbegin}}&lt;br /&gt;
&lt;br /&gt;
* {{cite book&lt;br /&gt;
 | last1 = Bach     | first1 = Eric&lt;br /&gt;
 | last2 = Shallit  | first2 = Jeffrey&lt;br /&gt;
 | year = 1996&lt;br /&gt;
 | title = Efficient Algorithms&lt;br /&gt;
 | series = Algorithmic Number Theory  | volume = I&lt;br /&gt;
 | publisher = [[The MIT Press]]&lt;br /&gt;
 | location = Cambridge, MA&lt;br /&gt;
 | isbn = 978-0-262-02405-1&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* {{cite journal&lt;br /&gt;
 | last1 = Carella  | first1 = N. A.&lt;br /&gt;
 | year = 2015&lt;br /&gt;
 | title = Least Prime Primitive Roots&lt;br /&gt;
 | journal = International Journal of Mathematics and Computer Science&lt;br /&gt;
 | volume = 10  | issue = 2  | pages = 185–194&lt;br /&gt;
 | arxiv=1709.01172&lt;br /&gt;
 }}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;[[Disquisitiones Arithmeticae]]&amp;#039;&amp;#039; has been translated from Gauss&amp;#039;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.&lt;br /&gt;
&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | last = Gauss | first = Carl Friedrich | author-link = Carl Friedrich Gauss&lt;br /&gt;
 | translator-last = Clarke  | translator-first = Arthur A.&lt;br /&gt;
 | orig-date = 1801  | year = 1986&lt;br /&gt;
 | title = Disquisitiones Arithmeticae   | edition = 2nd, corrected&lt;br /&gt;
 | publisher = [[Springer Science+Business Media|Springer]]&lt;br /&gt;
 | location = New York, NY&lt;br /&gt;
 | isbn = 978-0-387-96254-2&lt;br /&gt;
 | lang = EN&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | last = Gauss | first = Carl Friedrich | author-link = Carl Friedrich Gauss&lt;br /&gt;
 | translator-last = Maser  | translator-first = H.&lt;br /&gt;
 | orig-date = 1801  | year = 1965&lt;br /&gt;
 | title = Untersuchungen über höhere Arithmetik   | edition = 2nd&lt;br /&gt;
 | trans-title = Studies of Higher Arithmetic&lt;br /&gt;
 | publisher = Chelsea&lt;br /&gt;
 | location = New York, NY&lt;br /&gt;
 | isbn = 978-0-8284-0191-3&lt;br /&gt;
 | lang = DE&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = Neville  | last = Robbins&lt;br /&gt;
 | year = 2006&lt;br /&gt;
 | title = Beginning Number Theory&lt;br /&gt;
 | publisher = Jones &amp;amp; Bartlett Learning&lt;br /&gt;
 | isbn = 978-0-7637-3768-9&lt;br /&gt;
 | url = https://books.google.com/books?id=TtLMrKDsDuIC&amp;amp;pg=PA159&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | last = Vinogradov  | first = I.M.&lt;br /&gt;
 | author-link = Ivan Matveyevich Vinogradov&lt;br /&gt;
 | year = 2003&lt;br /&gt;
 | title = Elements of Number Theory&lt;br /&gt;
 | chapter = §&amp;amp;nbsp;VI Primitive roots and indices&lt;br /&gt;
 | pages = 105–121&lt;br /&gt;
 | publisher = Dover Publications&lt;br /&gt;
 | location = Mineola, NY&lt;br /&gt;
 | isbn = 978-0-486-49530-9&lt;br /&gt;
 | chapter-url = https://books.google.com/books?id=xlIfdGPM9t4C&amp;amp;pg=PA105&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
*{{cite journal&lt;br /&gt;
 | last1 = von zur Gathen  | first1 = Joachim&lt;br /&gt;
 | author1-link = Joachim von zur Gathen&lt;br /&gt;
 | last2 = Shparlinski  | first2 = Igor&lt;br /&gt;
 | year = 1998&lt;br /&gt;
 | title = Orders of Gauss periods in finite fields&lt;br /&gt;
 | journal = Applicable Algebra in Engineering, Communication and Computing&lt;br /&gt;
 | volume = 9  | issue = 1  | pages = 15–24&lt;br /&gt;
 | mr = 1624824  | s2cid = 19232025&lt;br /&gt;
 | doi = 10.1007/s002000050093&lt;br /&gt;
 }}&lt;br /&gt;
{{refend}}&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | last = Ore  | first = Oystein  | author-link = Øystein Ore&lt;br /&gt;
 | year = 1988&lt;br /&gt;
 | title = Number Theory and Its History&lt;br /&gt;
 | publisher = Dover&lt;br /&gt;
 | pages = [https://archive.org/details/numbertheoryitsh0000orey/page/284 284–302]&lt;br /&gt;
 | isbn = 978-0-486-65620-5&lt;br /&gt;
 | url = https://archive.org/details/numbertheoryitsh0000orey/page/284&lt;br /&gt;
 }}.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* {{MathWorld&lt;br /&gt;
 | title = Primitive Root&lt;br /&gt;
 | id = PrimitiveRoot&lt;br /&gt;
}}&lt;br /&gt;
*{{cite web&lt;br /&gt;
 | last = Holt&lt;br /&gt;
 | title = Quadratic residues and primitive roots&lt;br /&gt;
 | publisher = Michigan Tech&lt;br /&gt;
 | department = Mathematics&lt;br /&gt;
 | url = http://www.math.mtu.edu/mathlab/COURSES/holt/dnt/quadratic4.html&lt;br /&gt;
}}&lt;br /&gt;
* {{cite web&lt;br /&gt;
 | title = Primitive roots calculator&lt;br /&gt;
 | website = BlueTulip&lt;br /&gt;
 | url = http://www.bluetulip.org/programs/primitive.html&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Modular arithmetic]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Athina241</name></author>
	</entry>
</feed>