# 合数

合数是大于1且不是素数的正整数，也就是说，它除了1和自身之外还有其他因子；等价地，它可以写成两个更小的、均大于1的整数之积<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup>。例如，6 = 2 × 3是合数，而7无法由更小的整数相乘得到，是素数<sup>[2](https://www.mathsisfun.com/definitions/composite-number.html)</sup>。数字1是一个特例，既不算素数也不算合数<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup>，因此每个大于1的整数要么是合数，要么是素数<sup>[2](https://www.mathsisfun.com/definitions/composite-number.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 大于1且非素数的正整数n，即除1和自身外还有其他因子<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup> |
| 最初的例子 | 4、6、8、9、10、12、14、15、16、……（OEIS A002808）<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup> |
| 1的地位 | 既非素数也非合数<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup> |
| 计数 | 不超过n的合数个数为n − π(n) − 1，其中π(n)统计不超过n的素数个数<sup>[3](https://oeis.org/A002808)</sup> |
| 无穷性 | 合数有无穷多个<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup> |
| 连续合数段 | 对任意正整数n，都存在n个连续的合数<sup>[4](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Elementary_Number_Theory_%28Barrus_and_Clark%29/01%3A_Chapters/1.11%3A_Prime_Numbers)</sup> |
| 密码学中的作用 | RSA模数是合数，即两个素数p与q之积，按现行美国联邦标准其比特长度至少为2048<sup>[5](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf)</sup> |

## 定义与基本性质

这一定义可以用两种等价的方式表述。从乘法的角度说，合数是能由其他整数相乘得到的整数，但要排除1 × n和n × 1这类平凡乘积<sup>[2](https://www.mathsisfun.com/definitions/composite-number.html)</sup>。从除法的角度说，一个数若能被1和自身以外的整数整除，它就是合数；例如12可被1、2、3、4、6和12整除，所以它的因子多于素数所要求的两个<sup>[6](https://www.mathsisfun.com/prime-composite-number.html)</sup>。

每个合数都有唯一的素因子分解，称为它的素因数分解。最初的几个合数及其分解为4 = 2²、6 = 2·3、8 = 2³、9 = 3²、10 = 2·5、12 = 2²·3，等等<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup>。“合数”这一名称正体现了“composite”（合成的）一词的含义：合数是由素数相乘“合成”的<sup>[6](https://www.mathsisfun.com/prime-composite-number.html)</sup>。

**合数的计数。** 由于1既非素数也非合数，不超过n的合数个数为n − π(n) − 1，其中π(n)为素数计数函数<sup>[3](https://oeis.org/A002808)</sup>。第n个合数cₙ满足cₙ = π(cₙ) + 1 + n，且当n ≥ 4时有形如n + n/log n + n/log²n < cₙ < n + n/log n + 3n/log²n的界成立<sup>[3](https://oeis.org/A002808)</sup>。合数有无穷多个，这是素数无穷性与任意长连续合数段存在这两点共同推出的结论<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup>。

## 古代起源

这一概念见于欧几里得（Euclid）《几何原本》第七卷（约公元前300年），那是他关于数论的三卷中的第一卷。定义13称“合数就是能被某个数度量的数”，意即可被某个更小的数整除的数；而定义11把素数定义为仅能被单位度量的数<sup>[7](https://www.perseus.tufts.edu/hopper/text?doc=Euc.+7&fromdoc=Perseus%3Atext%3A1999.01.0086)</sup>。同卷命题31证明，任何合数都能被某个素数度量：反复取更小的因子，直至得到素数；这一论证依赖于严格递减的数列必定终止的原则<sup>[8](https://www.euclids-elements.org/elements/books/bookVII/propositions/propVII31/)</sup>。这一结果正是现代命题“每个大于1的整数都有素因子，从而有素因数分解”的基础。

## 在整数中的分布

随着数字增大，合数在自然数中占据的比例越来越大。素数定理由雅克·阿达马（Jacques Hadamard）与夏尔-让·德·拉·瓦莱·普桑（Charles-Jean de la Vallée Poussin）于1896年各自独立证明，它指出π(x) ∼ x/log x，因此不超过n的整数中约有1/log n是素数<sup>[9](https://www.math.uwaterloo.ca/~f2alfais/notes/pm340-notes.pdf)</sup>。其余部分（扣除1之后）约为n − n/log n，是合数，这一比例趋近于1。

给定任意正整数n，都能找到一个整数a，使得a、a+1、……、a+(n−1)这n个连续整数每一个都是合数。标准构造取a = (n+1)! + 2：其中每一项(n+1)! + i + 2都能被i + 2整除，而i + 2介于2与n+1之间，且小于该项本身<sup>[4](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Elementary_Number_Theory_%28Barrus_and_Clark%29/01%3A_Chapters/1.11%3A_Prime_Numbers)</sup>。这表明素数间隙可以任意长，尽管断言存在无穷多对相差为2的素数的孪生素数猜想至今仍未获证<sup>[4](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Elementary_Number_Theory_%28Barrus_and_Clark%29/01%3A_Chapters/1.11%3A_Prime_Numbers)</sup>。

## 判定合数：素性测试

判断一个数是否为合数，无论在实践上还是理论上，都比找出它的因子容易。大多数快速检验都是概率性的，且严格说来是合数检验：当数为合数时它们能证明其为合数，否则只能给出它是素数的有力证据。基于费马小定理的米勒-拉宾测试具有这样的性质：任何合数n（包括能骗过较简单的费马测试的卡迈克尔数，如561 = 3 × 11 × 17）通过单轮随机测试的概率至多为1/4；重复多轮可使误差按指数下降<sup>[10](https://crypto.stanford.edu/pbc/notes/numbertheory/millerrabin.html)</sup>。

2004年出现了确定性的多项式时间替代方案：当时均在印度理工学院坎普尔分校的曼宁德拉·阿格拉沃尔（Manindra Agrawal）、尼拉杰·卡亚尔（Neeraj Kayal）和尼廷·萨克塞纳（Nitin Saxena）在《数学年刊》上发表了AKS素性测试，这是一个无条件的确定性多项式时间算法，用以判定输入数是素数还是合数<sup>[11](https://annals.math.princeton.edu/2004/160-2/p12)</sup>。与之相关的判定问题是：给定N，是否存在正整数m和n使N = mn，这被称为合数问题；其复杂性多年来一直未知，尽管已知该问题属于NP ∩ co-NP<sup>[12](https://mathworld.wolfram.com/CompositeNumberProblem.html)</sup>。

## 密码学中的合数

RSA加密的安全性建立在乘法与因数分解之间的落差之上。将两个大素数p和q相乘得到合数模数n = pq是容易的，但仅由n反推p和q则极其困难，这一性质被用来构建实用的电子数据加密系统<sup>[13](https://mathworld.wolfram.com/news/2005-05-10/rsa-200/)</sup>。在NIST以FIPS 186-5标准化的RSA数字签名方案中，公钥由一个模数n（两个正整数素数p与q之积）以及一个公开指数e组成，标准要求模数比特长度至少为2048位，且p与q比特长度相同<sup>[5](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf)</sup>。

RSA因数分解挑战公布了一批合数，以数字位数命名，并特意选取为难以分解的数。2005年5月，德国联邦信息技术安全局（BSI）的一个团队宣布分解了RSA-200——一个200位的半素数，该团队此前还分解了174位的RSA-576<sup>[13](https://mathworld.wolfram.com/news/2005-05-10/rsa-200/)</sup>。这类结果衡量的是分解那些素性从无疑问的合数在实践中的难度，因为对候选因子做素性测试远比分解本身廉价<sup>[13](https://mathworld.wolfram.com/news/2005-05-10/rsa-200/)</sup>。

## 特殊类别

数论中有若干有名称的合数类别。半素数是恰有两个素因子的合数，也是每个RSA挑战数的形式<sup>[13](https://mathworld.wolfram.com/news/2005-05-10/rsa-200/)</sup>。史密夫数是各位数字之和等于其素因子（不含1）各位数字之和的合数，罗德尼·麦克丹尼尔（Rodney McDaniel）于1987年证明了史密夫数有无穷多个<sup>[14](https://mathworld.wolfram.com/SmithNumber.html)</sup>。高合成数是因子个数多于任何更小正整数的合数，是另一类被研究的合数族<sup>[1](https://mathworld.wolfram.com/CompositeNumber.html)</sup>。

某些合数还具有结构性的恒等刻画：整数n是合数当且仅当σ(n) + φ(n) > 2n，其中σ为约数和函数，φ为欧拉函数<sup>[3](https://oeis.org/A002808)</sup>；并且每个合数都能写成公差为2的严格正整数等差数列之和，如4 = 1 + 3、9 = 1 + 3 + 5<sup>[3](https://oeis.org/A002808)</sup>。

## References

1. [Weisstein, Eric W. "Composite Number." MathWorld--A Wolfram Resource.](https://mathworld.wolfram.com/CompositeNumber.html)
2. [Composite Number Definition, Illustrated Mathematics Dictionary, Math is Fun.](https://www.mathsisfun.com/definitions/composite-number.html)
3. [A002808: The composite numbers, The On-Line Encyclopedia of Integer Sequences.](https://oeis.org/A002808)
4. [Prime Numbers, Section 1.11, Elementary Number Theory (Barrus and Clark), Mathematics LibreTexts.](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Elementary_Number_Theory_%28Barrus_and_Clark%29/01%3A_Chapters/1.11%3A_Prime_Numbers)
5. [FIPS 186-5, Digital Signature Standard (DSS), NIST.](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf)
6. [Prime Numbers and Composite Numbers, Math is Fun.](https://www.mathsisfun.com/prime-composite-number.html)
7. [Euclid, Elements, Book VII, Perseus Digital Library.](https://www.perseus.tufts.edu/hopper/text?doc=Euc.+7&fromdoc=Perseus%3Atext%3A1999.01.0086)
8. [Euclid's Elements, Book VII, Proposition 31.](https://www.euclids-elements.org/elements/books/bookVII/propositions/propVII31/)
9. [Lecture 7: The Distribution of Primes, PM 340 notes, University of Waterloo.](https://www.math.uwaterloo.ca/~f2alfais/notes/pm340-notes.pdf)
10. [Primality Tests: The Miller-Rabin Test, Stanford cryptography notes.](https://crypto.stanford.edu/pbc/notes/numbertheory/millerrabin.html)
11. [Agrawal, Manindra; Kayal, Neeraj; Saxena, Nitin (2004). "PRIMES is in P." Annals of Mathematics 160(2): 781-793.](https://annals.math.princeton.edu/2004/160-2/p12)
12. [Weisstein, Eric W. "Composite Number Problem." MathWorld--A Wolfram Resource.](https://mathworld.wolfram.com/CompositeNumberProblem.html)
13. [Weisstein, Eric W. "MathWorld News: RSA-200 Factored" (May 10, 2005), MathWorld.](https://mathworld.wolfram.com/news/2005-05-10/rsa-200/)
14. [Weisstein, Eric W. "Smith Number." MathWorld--A Wolfram Resource.](https://mathworld.wolfram.com/SmithNumber.html)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Analytic number theory › Primes and factorization

Copyright 2026 Edgepedia

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

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

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