# 分拆函数（数论）

在数论中，分拆函数 p(n) 计算的是非负整数 n 可以写成若干个正整数之和的方式数，不计被加项的次序；按照约定 p(0) = 1，即空分拆。<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup> 例如，4 有五种分拆（4、3+1、2+2、2+1+1 和 1+1+1+1），所以 p(4) = 5。该函数增长极快，没有简单的闭式，但它具有精确的生成函数、一个经典的递推公式、由哈代与拉马努金给出的精确渐近公式，以及由拉德马赫给出的精确收敛级数。<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup>

| 关键事实 | 细节 |
|---|---|
| 定义 | p(n) = 将 n 分拆为若干正整数的不受限分拆数，其中 p(0) = 1<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup> |
| 生成函数 | \( \sum_{n=0}^{\infty} p(n)x^n = 1/((1-x)(1-x^2)(1-x^3)\cdots) \)<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup> |
| 样本值 | p(10) = 42，p(100) = 190569292，p(200) = 3972999029388<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup> |
| 增长 | \( p(n) \sim e^{K\sqrt{n}}/(4n\sqrt{3}) \)，其中 \( K = \pi\sqrt{2/3} \)（哈代与拉马努金，1918）<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup> |
| 精确公式 | 拉德马赫的收敛级数（1937）精确给出 p(n)<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC1076871/?page=0)</sup> |
| 同余式 | p(5k+4) ≡ 0 (mod 5)，p(7k+5) ≡ 0 (mod 7)，p(11k+6) ≡ 0 (mod 11)，由拉马努金证明<sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup> |
| 计算记录 | p(10<sup>19</sup>) 于 2012 年通过优化的哈代–拉马努金–拉德马赫实现计算得出<sup>[5](https://fredrikj.net/math/hrr.html)</sup> |

## 生成函数与欧拉递推

生成函数将整个序列编码于其中。由于 n 的一个分拆由其中含有多少个 1、多少个 2、多少个 3 等等所决定，乘积 \( \prod_{k=1}^{\infty}(1-x^k)^{-1} \) 展开为幂级数后，其 \( x^n \) 项的系数恰好就是 p(n)。<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup> 哈代与拉马努金注意到，这个函数本质上是一个模函数的倒数，而这正是其深刻算术结构的关键所在。<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup>

**欧拉五边形数定理。** 欧拉证明了生成函数的倒数具有一个稀疏展开：

\[ \prod_{k=1}^{\infty}(1-x^k) = \sum_{k=-\infty}^{\infty} (-1)^k x^{k(3k-1)/2} = 1 - x - x^2 + x^5 + x^7 - x^{12} - x^{15} + \cdots \]

指数 1、2、5、7、12、15、…… 即为广义五边形数 \( \omega(\pm k) = (3k^2 \mp k)/2 \)。<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup> 将两个级数相乘并比较系数，便得到一个由先前值计算 p(n) 的递推公式：

\[ p(n) = p(n-1) + p(n-2) - p(n-5) - p(n-7) + p(n-12) + p(n-15) - \cdots \]

其中当 k < 0 时 p(k) = 0。<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup> 由于小于 n 的五边形数大约只有 \( \sqrt{n} \) 个，每个值只需用到那么多个先前项；以此方式计算 p(0)、……、p(n) 大约需要 \( n^{2+o(1)} \) 次运算，而基于快速傅里叶变换的现代级数求逆可达到 \( O(M(n)) \)，对于一次性求出整张表而言这几乎是最优的。<sup>[6](https://isa-afp.org/entries/Pentagonal_Number_Theorem.html)</sup><sup> • </sup><sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup> 第二个递推公式 \( n\,p(n) = \sum_{k=1}^{n} \sigma_1(k)\,p(n-k) \)，其中 \( \sigma_1(k) \) 是 k 的因子之和，可由生成函数的对数微分得出。<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup>

## 哈代–拉马努金渐近公式

1918 年之前，分拆理论几乎完全是通过代数恒等式发展起来的，哈代与拉马努金注意到，文献中没有任何关于 p(n) 数量级的提及。<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup> 他们的论文运用了研究素数分布时所使用的解析方法，分析了生成函数系数在单位圆附近的柯西积分。<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup> 其结果便是渐近估计

\[ p(n) \sim \frac{e^{K\sqrt{n}}}{4n\sqrt{3}}, \qquad K = \pi\sqrt{2/3}. \]

该公式表明，p(n) 是一个大约有 \( n^{1/2} \) 位十进制数字的数，因此分拆数增长得比任何多项式都快，但对固定的 c 而言又慢于 \( e^{cn} \)。<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup><sup> • </sup><sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup> 一阶估计已经足够精确，以至于哈代与拉马努金用它算出的 p(200) 让他们觉得没有必要再做进一步验证。<sup>[1](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)</sup>

## 拉德马赫的精确级数

1937 年，时任宾夕法尼亚大学数学家的汉斯·拉德马赫（Hans Rademacher）将渐近展开加强为一个精确收敛到 p(n) 的无穷级数，发表在《美国国家科学院院刊》上。<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC1076871/?page=0)</sup> 哈代–拉马努金–拉德马赫公式对以 k 为下标的项求和，每一项由一个戴德金和以及在 \( n - 1/24 \) 处取值的双曲函数构成；将级数保留足够多项后截断，便给出具有严格误差界的 p(n)。<sup>[2](https://dlmf.nist.gov/draft1/27.14)</sup><sup> • </sup><sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup> 由于它直接计算单个值，该公式是处理孤立大 n 的首选方法：一个优化实现可在软最优时间 \( O(n^{1/2+o(1)}) \) 内算出 p(n)，与答案的位数相匹配。<sup>[5](https://fredrikj.net/math/hrr.html)</sup> 弗雷德里克·约翰松（Fredrik Johansson）——当时一位从事任意精度算术软件工作的数学家——利用它在 2012 年算出了 p(10<sup>19</sup>)，指数是此前任何已报告值的两倍；他的实现现已成为 FLINT 库的一部分并被 Sage 默认使用，计算 p(10<sup>12</sup>) 约需 14 秒。<sup>[5](https://fredrikj.net/math/hrr.html)</sup>

## 拉马努金同余式与现代算术

拉马努金检查了珀西·麦克马洪（Percy MacMahon）用手算借助欧拉递推算到 n = 200 的一张表，注意到某些值总能被固定的素数整除，后来他证明了最初几种情形：<sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup>

- p(5k + 4) ≡ 0 (mod 5)，
- p(7k + 5) ≡ 0 (mod 7)，
- p(11k + 6) ≡ 0 (mod 11)。

这些同余式开启了一个庞大的研究计划。时任威斯康星大学数论学家的肯·小野（Ken Ono）于 2000 年证明，对每个素数 \( \ell \geq 5 \)，分拆函数都满足无穷多个模 \( \ell \) 的同余式，形如 \( p((\ell^k m^3 n + 1)/24) \equiv 0 \pmod{\ell} \)，对占素数总体比例为正的一批素数 m 成立。<sup>[7](https://arxiv.org/abs/2401.03663)</sup> 这些证明依赖于模形式（高度对称的复函数，是证明分拆同余式的核心工具）：生成函数通过戴德金 η 函数 \( \eta(\tau) = q^{1/24}\prod(1-q^n) \) 表达后，是一个权为 \( -1/2 \) 的模形式，而当相关的生成函数位于模形式的赫克不变空间之中时，同余式便随之成立。<sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup><sup> • </sup><sup>[7](https://arxiv.org/abs/2401.03663)</sup> 对 n 至 10<sup>9</sup> 的 p(n) 模小素数的大规模计算已被用于发现和验证此类同余式。<sup>[4](https://fredrikj.net/thesis/thesis.pdf)</sup>

## 与物理学的联系

同一个生成函数也出现在统计力学中。整数的分拆理论描述了一维谐振阱中理想玻色子的统计力学，其中将能量量子分配给各振子字面上就是一个分拆问题，而渐近分拆公式已被用于推导玻色–爱因斯坦凝聚体的微正则涨落公式。<sup>[8](https://journals.aps.org/pre/abstract/10.1103/PhysRevE.54.3495)</sup> 分拆理论也是玻色–爱因斯坦、费米–狄拉克、真蒂莱（Gentile）和麦克斯韦–玻尔兹曼统计的基础，每一种统计对应于对分拆项可以如何重复的不同限制。<sup>[9](https://www.tandfonline.com/doi/abs/10.1080/0020739X.2015.1071441)</sup> 反过来，1999 年的一项研究构造了一种“素数气体”，其能级为相邻素数之间的间隔，并论证其配分函数的行为类似于一组非相互作用谐振子的配分函数，这是统计物理与数论之间若干联系之一，其他联系还包括通过关于配分函数零点的李–杨定理为黎曼猜想提出的自旋模型方法。<sup>[10](https://www.sciencedirect.com/science/article/abs/pii/S0378437199003180)</sup> 更近期，分拆理论已被用于研究丢番图集与素数分布，延续了一个由分拆泽塔函数和算术密度为经典乘性数论提供启示的研究纲领。<sup>[11](https://doi.org/10.1073/pnas.2409417121)</sup>

## References

1. [G. H. Hardy and S. Ramanujan (1918). Asymptotic formulæ in combinatory analysis, Proceedings of the London Mathematical Society s2-17: 75–115 (full text at the Ramanujan Papers archive).](https://ramanujan.sirinudi.org/Volumes/published/ram36.html)
2. [DLMF §27.14, Unrestricted Partitions, NIST Digital Library of Mathematical Functions.](https://dlmf.nist.gov/draft1/27.14)
3. [Hans Rademacher (1937). A Convergent Series for the Partition Function p(n), PNAS 23(2): 78–84.](https://pmc.ncbi.nlm.nih.gov/articles/PMC1076871/?page=0)
4. [Fredrik Johansson. Computing the partition function (thesis chapter on the pentagonal number theorem and the HRR formula).](https://fredrikj.net/thesis/thesis.pdf)
5. [Fredrik Johansson (2012). Efficient implementation of the Hardy-Ramanujan-Rademacher formula, LMS Journal of Computation and Mathematics 15: 341–359.](https://fredrikj.net/math/hrr.html)
6. [The Partition Function and the Pentagonal Number Theorem, Archive of Formal Proofs.](https://isa-afp.org/entries/Pentagonal_Number_Theorem.html)
7. [Congruence properties modulo prime powers for a class of partition functions, arXiv:2401.03663.](https://arxiv.org/abs/2401.03663)
8. [Microcanonical fluctuations of a Bose system's ground state occupation number, Physical Review E 54, 3495 (1996).](https://journals.aps.org/pre/abstract/10.1103/PhysRevE.54.3495)
9. [A brief history of partitions of numbers, partition functions and their modern applications, International Journal of Mathematical Education in Science and Technology 47(3).](https://www.tandfonline.com/doi/abs/10.1080/0020739X.2015.1071441)
10. [Applications of statistical mechanics in number theory, Physica A 274: 149–157 (1999).](https://www.sciencedirect.com/science/article/abs/pii/S0378437199003180)
11. [Integer partitions detect the primes, PNAS (2023).](https://doi.org/10.1073/pnas.2409417121)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Arithmetic and number systems › Integer sequences and partitions › Partitions › Partition function p(n)

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/partition-function-number-theory

English original: https://www.edgepedia.org/partition-function-number-theory
