# 模 n 的原根

**模 n 的原根**（primitive root modulo n）是与 n 互素的整数 g，其幂次遍历模 n 的所有与 n 互素的数：对每个满足 gcd(a, n) = 1 的整数 a，都存在某个 k 使得 g^k ≡ a (mod n)。等价地说，g 的乘法阶为 φ(n)，其中 φ 为欧拉函数，因此 g 生成模 n 的单位乘法群。<sup>[1](https://mathworld.wolfram.com/PrimitiveRoot.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 若每个与 n 互素的 a 都满足对某个 k 有 g^k ≡ a (mod n)，则 g 是模 n 的原根；等价地，ord(g) = φ(n)<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> |
| 哪些模数有原根 | 恰好是 1、2、4、p^k 和 2p^k，其中 p 为奇素数，k ≥ 1<sup>[3](https://zoo.cs.yale.edu/classes/cs467/2006f/attach/ln11.html)</sup> |
| 有多少个 | 若 n 有原根，则恰好有 φ(φ(n)) 个<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> |
| 检验 | 卢卡斯检验：g 是素数 p 的原根，当且仅当对 p − 1 的每个素因子 q 都有 g^((p−1)/q) ≢ 1 (mod p)<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> |
| 找一个原根 | 没有公式能从素数直接给出原根；随机选取单位并试错，每个随机单位的成功概率为 φ(p−1)/(p−1)<sup>[4](https://alozano.clas.uconn.edu/wp-content/uploads/sites/490/2022/12/amstext35.pdf)</sup> |
| 最小原根 | Burgess（1962）证明了：对充分大的素数 p，有 g_p ≤ C·p^(1/4+ε)<sup>[1](https://mathworld.wolfram.com/PrimitiveRoot.html)</sup> |
| 未解问题 | Artin 于 1927 年提出的猜想——除 −1 和完全平方数外的任何整数都是正密度多个素数的原根——至今仍未解决<sup>[5](https://www.sciencedirect.com/science/article/pii/S0022314X24000829)</sup> |

## 定义与阶的视角

单位 a 模 n 的乘法阶记作 ord(a)，是满足 a^k ≡ 1 (mod n) 的最小 k ≥ 1；它总是整除 φ(n)。<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> 一个单位是原根，当且仅当其阶等于整个单位群的阶 φ(n)。<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> 用群论的语言说，原根恰好是单位群 (Z/nZ)^× 的生成元，而一个模数有原根，恰好当该群是循环群。<sup>[6](https://alphabetamath.cc/number-theory/primitive-roots-and-unit-groups-modulo-n)</sup>

对素数模 p，单位群的阶为 p − 1，因此模 p 的原根就是其剩余类乘法阶为 p − 1 的整数。<sup>[1](https://mathworld.wolfram.com/PrimitiveRoot.html)</sup> 原根 g 的幂次于是把每个单位恰好给出一次，即 g^1, g^2, …, g^φ(n)，而指数的作用如同对数：b 以 g 为底的离散对数就是满足 b ≡ g^k (mod p) 的 k。<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup>

## 哪些模数有原根

并非每个整数 n 都有原根。由高斯定理，有原根的数是 1、2、4、p^k 和 2p^k，其中 p 为奇素数，k ≥ 1；特别地，每个素数都有原根。<sup>[3](https://zoo.cs.yale.edu/classes/cs467/2006f/attach/ln11.html)</sup> MathWorld 将同一分类表述为 2、4、p^a 或 2p^a，其中 p 为奇素数，a ≥ 1。<sup>[1](https://mathworld.wolfram.com/PrimitiveRoot.html)</sup>

个数由群结构推出。若 g 是原根，x 与 φ(n) 互素，则 g^x 仍是原根，这样的指数有 φ(φ(n)) 个；所以一个有原根的模数恰好有 φ(φ(n)) 个原根。<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> 例如模 17 有 φ(16) = 8 个原根：3、5、6、7、10、11、12 和 14，而模 8 没有原根。<sup>[7](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Yet_Another_Introductory_Number_Theory_Textbook_-_Cryptology_Emphasis_%28Poritz%29/05%3A_Indices__Discrete_Logarithms/5.03%3A_Primitive_Roots)</sup>

## 历史

卡尔·弗里德里希·高斯（Carl Friedrich Gauss）在《算术研究》（*Disquisitiones Arithmeticae*，1801）第 57 条中引入了原根，并称欧拉（Euler）创造了这一术语。高斯在第 56 条中写道，兰伯特（Lambert）和欧拉已经知道这些数，但他声称自己是第一个完整严格地证明模为素数时原根存在的人。该书的目录显示了相关体系：第 58 条给出计算指数的算法，第 73 条给出求原根的方法，第 82、90、92 条分别处理素数幂、二的幂与合数模。<sup>[8](https://en.wikisource.org/wiki/Translation%3ADisquisitiones_Arithmeticae)</sup> 高斯还在第 81 条中证明，素数 p 的所有原根之和模 p 等于 μ(p−1)，即莫比乌斯函数值。<sup>[9](https://oeis.org/A121380)</sup>

## 求原根

对合格的模数，存在性有保证，但没有公式能从给定素数产生原根，而对大素数 p 找一个原根是困难问题。<sup>[4](https://alozano.clas.uconn.edu/wp-content/uploads/sites/490/2022/12/amstext35.pdf)</sup><sup> • </sup><sup>[10](https://www.math.ucsd.edu/~drogalsk/200a-f21-coursenotes.pdf)</sup> 标准方法是有根据的试错：计算随机单位的阶，直到某个单位的阶为 p − 1。<sup>[4](https://alozano.clas.uconn.edu/wp-content/uploads/sites/490/2022/12/amstext35.pdf)</sup>

这种搜索的胜算很大。由于 p − 1 个单位中有 φ(p − 1) 个原根，随机单位是原根的概率为 φ(p−1)/(p−1)；在前 100,000 个素数中，该比值的最小值为 0.1852，出现在 p = 870871 时。<sup>[4](https://alozano.clas.uconn.edu/wp-content/uploads/sites/490/2022/12/amstext35.pdf)</sup> 一旦知道 p − 1 的素因数分解，卢卡斯检验使每个候选者的验证都很廉价：g 是 p 的原根，当且仅当对 p − 1 的每个素因子 q 都有 g^((p−1)/q) ≢ 1 (mod p)。<sup>[2](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)</sup> 失败的候选者也带有信息，因为 u^n 的阶整除 u 的阶，所以由非原根 u 派生出的单位可以不再检验直接丢弃。<sup>[4](https://alozano.clas.uconn.edu/wp-content/uploads/sites/490/2022/12/amstext35.pdf)</sup>

前几个素数的最小原根为 1、2、2、3、2、2、3、2、5、2、3、2、6、3、5、2、2、2、……（OEIS A001918）。<sup>[1](https://mathworld.wolfram.com/PrimitiveRoot.html)</sup> 在理论方面，Burgess 于 1962 年证明了：模 p 的最小原根 g_p 对充分大的 p 满足 g_p ≤ C·p^(1/4+ε)，其中 C、ε 为正的常数。<sup>[1](https://mathworld.wolfram.com/PrimitiveRoot.html)</sup>

## Artin 猜想

1927 年 Artin 猜想：任何既不是 −1 也不是完全平方数的整数 a，都是正密度多个素数 p 的原根。该猜想仍未解决，尽管过去六十年已有实质进展；Moree 和 Stevenhagen 于 2000 年提出的二变量版本，在关于某些戴德金 ζ 函数的广义黎曼假设下，已知具有正密度。<sup>[5](https://www.sciencedirect.com/science/article/pii/S0022314X24000829)</sup> 夏威夷大学希洛分校的李曙光（Shuguang Li）与曾任职于朗讯科技贝尔实验室的 Carl Pomerance 的综述文章汇集了主要定理与猜想，并把原根概念推广到任意合数模——此时原根是缩剩余类群中生成最大阶循环子群的一个剩余类。<sup>[11](https://math.dartmouth.edu/~carlp/PDF/primitiverootstoo.pdf)</sup>

## 应用

**密码学。** 原根定理表明，模素数的整数构成一个循环群，即单个数的全部幂次，这一性质用于 ElGamal 系统等公钥密码系统、签名方案和素性检验。<sup>[12](https://www.math.columbia.edu/department/rama/chapters/chap7.html)</sup> Diffie-Hellman 密钥交换是以模素数的单位群生成元来规定的：RFC 4419 为 SSH 定义了 Diffie-Hellman 群交换，其中指出当模数 p 为安全素数 p = 2q + 1 时，指数取遍整个 p − 1 阶群的生成元称为原根，且在这种情况下很容易找到。<sup>[13](https://datatracker.ietf.org/doc/html/rfc4419.html)</sup>

**伪随机数。** 在线性同余生成器 x_{n+1} ≡ a·x_n + c (mod m) 中，序列只有在乘数满足一定条件时才能达到满周期 m；当 c = 0 时，乘数必须是模 m 的原根。例如 a = 3 是模 31 的原根，因此序列周期为 30。<sup>[14](https://pi.math.cornell.edu/~mec/Winter2009/Luo/Linear%20Congruential%20Generator/linear%20congruential%20gen1.html)</sup>

## References

1. [Primitive Root, Wolfram MathWorld](https://mathworld.wolfram.com/PrimitiveRoot.html)
2. [Handout 11: Primitive roots and discrete log, Yale CS 467 (2017)](https://zoo.cs.yale.edu/classes/cs467/2017f/attach/ho11.html)
3. [Lecture notes 11, Yale CS 467 (2006)](https://zoo.cs.yale.edu/classes/cs467/2006f/attach/ln11.html)
4. [Álvaro Lozano-Robledo, *Number Theory* (AMS), Chapter 8: Existence of Primitive Roots Modulo p](https://alozano.clas.uconn.edu/wp-content/uploads/sites/490/2022/12/amstext35.pdf)
5. [S.G. Hazra, M. Ram Murty, J. Sivaraman, "A note on the two variable Artin's conjecture," Journal of Number Theory 262 (2024)](https://www.sciencedirect.com/science/article/pii/S0022314X24000829)
6. [Primitive Roots and Unit Groups Modulo N, Alphabeta Math](https://alphabetamath.cc/number-theory/primitive-roots-and-unit-groups-modulo-n)
7. [Section 5.3: Primitive Roots, Yet Another Introductory Number Theory Textbook (Poritz), LibreTexts](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Yet_Another_Introductory_Number_Theory_Textbook_-_Cryptology_Emphasis_%28Poritz%29/05%3A_Indices__Discrete_Logarithms/5.03%3A_Primitive_Roots)
8. [Translation:Disquisitiones Arithmeticae, Wikisource](https://en.wikisource.org/wiki/Translation%3ADisquisitiones_Arithmeticae)
9. [OEIS A121380: Sums of primitive roots for n](https://oeis.org/A121380)
10. [MATH 200 lecture notes, UC San Diego (2021)](https://www.math.ucsd.edu/~drogalsk/200a-f21-coursenotes.pdf)
11. [Shuguang Li and Carl Pomerance, "Primitive Roots: A Survey"](https://math.dartmouth.edu/~carlp/PDF/primitiverootstoo.pdf)
12. [Chapter 7: Primitive Roots, Columbia University number theory text](https://www.math.columbia.edu/department/rama/chapters/chap7.html)
13. [RFC 4419: Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol](https://datatracker.ietf.org/doc/html/rfc4419.html)
14. [Linear Congruential Generator, Cornell Math Explorer's Club (2009)](https://pi.math.cornell.edu/~mec/Winter2009/Luo/Linear%20Congruential%20Generator/linear%20congruential%20gen1.html)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026; Oct 25, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Elementary number theory › Orders, primitive roots, and the multiplicative group mod n

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/primitive-root-modulo-n

English original: https://www.edgepedia.org/primitive-root-modulo-n
