# 质数

**质数**（prime number），日常语境中简称素数，是任何大于1且不能分解为两个更小自然数之积的自然数；2、3、5、7即为例子<sup>[1](https://www.claymath.org/library/public_lectures/mazur_riemann_hypothesis.pdf)</sup>。质数是整数的乘法基石：算术基本定理指出，任何正整数都能以恰好一种方式表示为质数之积<sup>[2](https://mathworld.wolfram.com/PrimeNumber.html)</sup>。质数在纯数学与应用中均扮演重要角色，最显著的莫过于公钥密码学<sup>[1](https://www.claymath.org/library/public_lectures/mazur_riemann_hypothesis.pdf)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 大于1且不能分解为两个更小自然数之积的自然数；1既不是质数也不是合数<sup>[1](https://www.claymath.org/library/public_lectures/mazur_riemann_hypothesis.pdf)</sup><sup> • </sup><sup>[2](https://mathworld.wolfram.com/PrimeNumber.html)</sup> |
| 最小的质数 | 2，唯一的偶质数<sup>[2](https://mathworld.wolfram.com/PrimeNumber.html)</sup> |
| 无穷性 | 欧几里得在《几何原本》第九卷（约公元前300年）中证明了质数有无穷多个<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup> |
| 分布 | 小于x的质数个数渐近于x/log(x)，由阿达马与德拉瓦莱普桑于1896年证明<sup>[4](https://www.claymath.org/collections/riemanns-1859-manuscript/)</sup> |
| 已知最大质数 | 2<sup>136,279,841</sup> − 1，有41,024,320个十进制数字，由GIMPS于2024年10月12日发现<sup>[5](https://www.mersenne.org/primes/?press=M136279841)</sup> |
| 密码学用途 | RSA式公钥密码将两个各约400位的保密质数相乘，得到一个800位的公开乘积<sup>[6](https://dlmf.nist.gov/27.16)</sup> |
| 未解问题 | 孪生质数猜想（有无穷多对相差2的质数）仍未获证明；已证明存在不超过246的有界间隔<sup>[7](https://mathworld.wolfram.com/TwinPrimeConjecture.html)</sup> |

## 定义与基本性质

按照定义，质数是大于1且不能写成两个更小自然数之积的自然数<sup>[1](https://www.claymath.org/library/public_lectures/mazur_riemann_hypothesis.pdf)</sup>。大于1且能如此分解的整数，如4、6、8、9，称为合数<sup>[8](https://www.southampton.ac.uk/~wright/1001/chapter-primes.html)</sup>。

**1的地位。** 数字1是一个特例，既不被视为质数也不被视为合数<sup>[2](https://mathworld.wolfram.com/PrimeNumber.html)</sup>。将其排除在外，才能使算术基本定理按原样成立；因为若1是质数，那么任何n = n · 1都会使“恰好一种方式”的分解失效<sup>[2](https://mathworld.wolfram.com/PrimeNumber.html)</sup>。从历史上看，这个问题属于定义之争：对古希腊人而言，数（αριθμος）是单位的倍数，因此1根本不属于质数的范畴；安杰拉·雷迪克与熊阳的历史考察发现，在历史的大部分时间里，1都不被视为质数，也从未有过哪个时间点，明确多数的数学家视其为质数<sup>[9](https://scholarexchange.furman.edu/fuejum/vol16/iss1/1/)</sup>。

排除1之后，最小的质数是2，它也是唯一的偶质数；除2以外的所有质数构成的集合称为奇质数<sup>[2](https://mathworld.wolfram.com/PrimeNumber.html)</sup>。

## 早期历史

质数及其性质最早由古希腊数学家进行了广泛研究<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。到约公元前300年欧几里得《几何原本》问世时，若干重要结果已经得到证明：第九卷包含了质数有无穷多个的证明，这是已知最早的归谬法证明之一；欧几里得还给出了算术基本定理的证明<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。该证明假设质数只有p₁、p₂、……、p_k，并考虑m = p₁p₂……p_k + 1；由于m大于1，它必有一个质因数，而这个质因数不可能是所列出的任何一个质数——否则它就要整除1，矛盾<sup>[8](https://www.southampton.ac.uk/~wright/1001/chapter-primes.html)</sup>。

约公元前200年，埃拉托斯特尼发明了埃拉托斯特尼筛法，这是一种通过依次划去每个质数的倍数、只留下质数来找出某上限以内全部质数的算法<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。希腊人之后，历史呈现出黑暗时代的一段漫长空白，下一批重要进展由费马在17世纪初做出<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。

**费马小定理。** 费马证明了：若p为质数，则对任意整数a，有a<sup>p</sup> = a（模p）<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。该定理是检验数是否为质数的方法之基础，这些方法至今仍在电子计算机上使用<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。但其逆命题不成立：2<sup>341</sup> − 2能被341整除，而341 = 31 × 11是合数，因此这类检验本质上是概率性的<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。

## 质数的分布

质数在自然数中的分布不遵循任何规则模式<sup>[10](https://www.claymath.org/millennium/riemann-hypothesis/)</sup>。然而存在一条精确的平均规律。质数定理最早由高斯在青年时代提出，它指出小于x的质数个数渐近于x/log(x)；粗略地说，若在x附近随机选取一个数，它是质数的概率约为1/log(x)<sup>[4](https://www.claymath.org/collections/riemanns-1859-manuscript/)</sup>。黎曼1859年的论文仅有六页手稿，其中引入的思想促成了1896年阿达马与德拉瓦莱普桑对该定理的独立证明<sup>[4](https://www.claymath.org/collections/riemanns-1859-manuscript/)</sup>。

**黎曼猜想。** 黎曼观察到，质数的频率与黎曼ζ函数ζ(s) = 1 + 1/2<sup>s</sup> + 1/3<sup>s</sup> + 1/4<sup>s</sup> + ……的行为密切相关<sup>[10](https://www.claymath.org/millennium/riemann-hypothesis/)</sup>。他的猜想断言，ζ(s)所有非平凡零点都是实部为1/2的复数；该猜想已对前10,000,000,000,000个解进行验证，但证明仍悬而未决<sup>[10](https://www.claymath.org/millennium/riemann-hypothesis/)</sup>。质数定理描述质数的平均分布，黎曼猜想则描述对这一平均值的偏离<sup>[10](https://www.claymath.org/millennium/riemann-hypothesis/)</sup>。它是克雷数学研究所七大千禧年大奖难题之一<sup>[4](https://www.claymath.org/collections/riemanns-1859-manuscript/)</sup>。

## 间隔与猜想

质数定理表明，相邻质数之间的间隔平均约为log n<sup>[11](https://www.ams.org/journals/notices/202004/202004FullIssue.pdf)</sup>。小间隔是否无穷多次出现，是一个著名的未解问题：孪生质数猜想断言，存在无穷多对相差2的质数<sup>[7](https://mathworld.wolfram.com/TwinPrimeConjecture.html)</sup>。

**有界间隔。** 2013年，张益唐宣布证明了有界间隔猜想，确立了自然数H，使得无穷多对不同的质数p、q满足|p − q| < H<sup>[12](https://blogs.ams.org/mathgradblog/2013/06/24/small-gap-be-a-huge-landmark-number-theory/)</sup>。张益唐最初的界小于7000万<sup>[12](https://blogs.ams.org/mathgradblog/2013/06/24/small-gap-be-a-huge-landmark-number-theory/)</sup>。詹姆斯·梅纳德运用陶哲轩独立发展的多维筛法权重，以更简单、更强的形式重新证明了该结果，并证明对每个k，都有无穷多个n，使得长度有界的区间内含有k个质数<sup>[13](https://www.ams.org/notices/201506/rnoti-p660.pdf)</sup>。Polymath项目确立了无条件界H₁ ≤ 246，即有无穷多对相邻质数相隔至多246；这并未证明间隔2会出现无穷多次，因此孪生质数猜想仍未解决<sup>[7](https://mathworld.wolfram.com/TwinPrimeConjecture.html)</sup>。

一个相关的已证结果是布朗定理：孪生质数倒数之和收敛于一个确定的数，这表明即使孪生质数有无穷多对，它们也是稀少的；而所有质数的倒数之和则发散至无穷<sup>[14](https://mathworld.wolfram.com/TwinPrimes.html)</sup>。

## 已知最大质数与计算

形如2<sup>n</sup> − 1的数称为梅森数，长期以来提供了已知最大的质数<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。1952年，罗宾逊用一台早期计算机证明了梅森数M₅₂₁、M₆₀₇、M₁₂₇₉、M₂₂₀₃和M₂₂₈₁为质数，开启了电子时代<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。到2018年，共发现了50个梅森质数<sup>[3](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)</sup>。

当前的记录是2<sup>136,279,841</sup> − 1，有41,024,320个十进制数字，由加利福尼亚州圣何塞的卢克·杜兰特于2024年10月12日通过互联网梅森质数大搜索（GIMPS）发现<sup>[5](https://www.mersenne.org/primes/?press=M136279841)</sup>。它是已知的第52个梅森质数，比前一个记录多出1600多万位，是在NVIDIA A100上使用Gpuowl进行PRP检验发现的<sup>[5](https://www.mersenne.org/primes/?press=M136279841)</sup><sup> • </sup><sup>[15](https://www.mersenne.org/primes/)</sup>。

寻找质数远比分解因数容易。在大小为x的数附近，大约需要检验ln x个数才能找到一个质数；忽略偶数可将此数降至约(ln x)/2；对于一个100位的质数，这大约是115个奇数候选，而排除小质数的倍数还能进一步减少数量<sup>[16](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-2.pdf)</sup>。

## 密码学中的应用

密码学应用依赖于这样一个事实：计算机找到大质数所需的时间远少于分解大整数所需的时间。<sup>[6](https://dlmf.nist.gov/27.16)</sup>在典型的公钥构造中，编码者选取两个各约400位的保密大质数p和q，这项任务只需极少的计算机时间；质数保密，而其乘积n = pq（一个800位的数）则公开。消息仅用n编码，但解码需要两个因数<sup>[6](https://dlmf.nist.gov/27.16)</sup>。

检验大整数的素性在RSA及其他公钥系统的密钥生成中起着重要作用<sup>[16](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-2.pdf)</sup>。构造RSA密码的可行性取决于素性检验易于进行，而密码的安全性则取决于分解大数似乎十分困难这一点<sup>[17](https://www.nationalacademies.org/read/2026/chapter/5)</sup>。

**量子威胁。** 1994年，彼得·肖尔发现了一种量子算法，能在量子计算机上以多项式时间高效地找出大整数的质因数<sup>[18](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=934896)</sup>。对于足够大的数，据估计传统计算机需要数十亿年才能找出质因数，而一台能力足够的量子计算机可在数天甚至数小时内解决这一难题<sup>[19](https://www.nist.gov/cybersecurity-and-privacy/what-post-quantum-cryptography)</sup>。美国国家标准与技术研究院于2024年发布了首批三项最终确定的后量子密码学标准，其基础是结构化格与哈希函数而非因数分解；根据其过渡时间表，它将在2035年前从其标准中弃用并最终移除易受量子攻击的算法<sup>[19](https://www.nist.gov/cybersecurity-and-privacy/what-post-quantum-cryptography)</sup><sup> • </sup><sup>[20](https://csrc.nist.gov/Projects/Post-Quantum-Cryptography?source=post_page---------------------------)</sup>。

## References

1. [Barry Mazur, "The Riemann Hypothesis," Clay Mathematics Institute public lecture](https://www.claymath.org/library/public_lectures/mazur_riemann_hypothesis.pdf)
2. [Prime Number, Wolfram MathWorld](https://mathworld.wolfram.com/PrimeNumber.html)
3. [Prime numbers, MacTutor History of Mathematics, University of St Andrews](https://mathshistory.st-andrews.ac.uk/HistTopics/Prime_numbers/)
4. [Riemann's 1859 Manuscript, Clay Mathematics Institute](https://www.claymath.org/collections/riemanns-1859-manuscript/)
5. [Mersenne Prime Discovery, 2^136279841−1 is Prime, GIMPS](https://www.mersenne.org/primes/?press=M136279841)
6. [DLMF §27.16 Cryptography, NIST](https://dlmf.nist.gov/27.16)
7. [Twin Prime Conjecture, Wolfram MathWorld](https://mathworld.wolfram.com/TwinPrimeConjecture.html)
8. [Chapter 4 Prime Numbers, MATH1001, University of Southampton](https://www.southampton.ac.uk/~wright/1001/chapter-primes.html)
9. [Angela Reddick and Yeng Xiong, "The Search for One as a Prime Number," Furman University Electronic Journal of Undergraduate Mathematics 16 (2016)](https://scholarexchange.furman.edu/fuejum/vol16/iss1/1/)
10. [Riemann Hypothesis, Clay Mathematics Institute](https://www.claymath.org/millennium/riemann-hypothesis/)
11. [AMS Notices, April 2020, Cole Prize citation for James Maynard](https://www.ams.org/journals/notices/202004/202004FullIssue.pdf)
12. [Shijie Gu, "How 'small' can the gap be?," AMS Math Grad Blog, 2013](https://blogs.ams.org/mathgradblog/2013/06/24/small-gap-be-a-huge-landmark-number-theory/)
13. ["Prime Numbers: A...," AMS Notices, June/July 2015](https://www.ams.org/notices/201506/rnoti-p660.pdf)
14. [Twin Primes, Wolfram MathWorld](https://mathworld.wolfram.com/TwinPrimes.html)
15. [List of known Mersenne prime numbers, PrimeNet](https://www.mersenne.org/primes/)
16. [NIST Special Publication 800-2, Appendix L, Primality testing](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-2.pdf)
17. [National Research Council, Probability and Algorithms, Chapter 4](https://www.nationalacademies.org/read/2026/chapter/5)
18. [Dustin Moody and Angela Robinson, "Cryptographic Standards in a Post-Quantum Era," NIST, 2022](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=934896)
19. [What Is Post-Quantum Cryptography?, NIST](https://www.nist.gov/cybersecurity-and-privacy/what-post-quantum-cryptography)
20. [Post-Quantum Cryptography, NIST CSRC](https://csrc.nist.gov/Projects/Post-Quantum-Cryptography?source=post_page---------------------------)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Elementary number theory › Prime numbers: elementary aspects

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/prime-number

English original: https://www.edgepedia.org/prime-number
