Partition Numbers
Each positive integer in the sum is called a part.
Partition number: \(p_n\). The number of ways to partition the natural number \(n\).
Partition numbers starting from \(0\):
| n | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| \(p_n\) | 1 | 1 | 2 | 3 | 5 | 7 | 11 | 15 | 22 |
k-partition number
A partition of \(n\) into exactly \(k\) parts is called a k-partition, and its count is denoted as \(p(n,k)\).
Clearly, the k-partition number \(p(n,k)\) is also the number of solutions to the following equation:
If exactly \(j\) parts in this equation are non-zero, then there are exactly \(p(n-k,j)\) solutions. Therefore, we have the summation:
Taking the difference between two adjacent summations yields:
If we list the table, the number in each cell equals the number in the cell to its upper-left, plus the number in the cell located \(k\) rows above it in the same column.
| k | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| \(p(0,k)\) | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(p(1,k)\) | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(p(2,k)\) | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(p(3,k)\) | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| \(p(4,k)\) | 0 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
| \(p(5,k)\) | 0 | 1 | 2 | 2 | 1 | 1 | 0 | 0 | 0 |
| \(p(6,k)\) | 0 | 1 | 3 | 3 | 2 | 1 | 1 | 0 | 0 |
| \(p(7,k)\) | 0 | 1 | 3 | 4 | 3 | 2 | 1 | 1 | 0 |
| \(p(8,k)\) | 0 | 1 | 4 | 5 | 5 | 3 | 2 | 1 | 1 |
Example
Compute k-partition number
Compute the k-partition number \(p(n,k)\). Multiple inputs, where the upper bound for \(n\) is \(10000\), the upper bound for \(k\) is \(1000\), modulo \(1000007\).
Observing the table and the recurrence relation, updating by column is more advantageous for storage. It's straightforward to write the program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
Generating Function
From the geometric series summation formula, we have:
For the k-partition number, the generating function is slightly more complex. Specifically:
Ferrers Diagram
Ferrers Diagram: Represent each part of a partition by a row of dots. The number of dots in each row equals the size of that part.
According to the definition of a partition, different rows in a Ferrers diagram are arranged in decreasing order. The longest row is at the top.
For example: Ferrers diagram for the partition \(12=5+4+2+1\).

Reflecting a Ferrers diagram along its diagonal yields a new Ferrers diagram called the conjugate of the original, and the new partition is called the conjugate of the original partition. Clearly, conjugation is a symmetric relation.
For example, the conjugate of the partition \(12=5+4+2+1\) is \(12=4+3+2+2+1\).
Maximum k-partition number: The number of partitions of a natural number \(n\) with largest part equal to \(k\).
From the definition of conjugation, an obvious conclusion follows:
The maximum k-partition number is the same as the k-partition number, both are \(p(n,k)\).
Distinct Partition Number
Distinct partition number: \(pd_n\). The number of ways to partition the natural number \(n\) into distinct parts.
| n | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| \(pd_n\) | 1 | 1 | 1 | 2 | 2 | 3 | 4 | 5 | 6 |
Similarly, define the distinct k-partition number \(pd(n,k)\), representing the number of distinct partitions with exactly \(k\) parts, which is the number of solutions to this equation:
Exactly as before, it is also the number of solutions to this equation:
The difference here, due to distinctness, is that at most one part in the new equation can be zero. An unchanged conclusion: if exactly \(j\) parts are non-zero, then there are exactly \(pd(n-k,j)\) solutions, where \(j\) is either \(k\) or \(k-1\). Therefore, we directly obtain the recurrence:
Similarly, list a table like the binomial coefficients. The number in each cell equals the number in the cell one column to the left, \(k\) cells above it, plus the number in the cell \(k\) cells above it in the same column.
| k | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| \(pd(0,k)\) | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(pd(1,k)\) | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(pd(2,k)\) | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(pd(3,k)\) | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(pd(4,k)\) | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(pd(5,k)\) | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
| \(pd(6,k)\) | 0 | 1 | 2 | 1 | 0 | 0 | 0 | 0 | 0 |
| \(pd(7,k)\) | 0 | 1 | 3 | 1 | 0 | 0 | 0 | 0 | 0 |
| \(pd(8,k)\) | 0 | 1 | 3 | 2 | 0 | 0 | 0 | 0 | 0 |
Example
Compute Distinct Partition Number
Compute the distinct partition number \(pd_n\). Multiple inputs, where the upper bound for \(n\) is \(50000\), modulo \(1000007\).
Observing the table and the recurrence relation, updating by column is more advantageous for storage. In the code, space is reduced by keeping only two adjacent columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
Odd Partition Number
Odd partition number: \(po_n\). The number of ways to partition the natural number \(n\) into odd parts.
There is an obvious identity:
The leftmost side is the generating function for distinct partitions, the rightmost side is the generating function for odd partitions. Their corresponding coefficients are the same, therefore, the odd partition number equals the distinct partition number:
But clearly, the k-part odd partition number and the distinct k-part partition number are different concepts, and are not listed here.
Introduce two more concepts:
Even distinct partition number: \(pde_n\). The number of distinct partitions of natural number \(n\) with an even number of parts.
Odd distinct partition number: \(pdo_n\). The number of distinct partitions of natural number \(n\) with an odd number of parts.
Therefore:
There are also corresponding k-part concepts. They are too complex and are not listed.
Pentagonal Number Theorem
Consider the denominator part of the generating function for partition numbers separately:
Expanding this part, one can think of distinct partitions and the parity of the number of parts in a distinct partition.
Specifically, even distinct partitions are counted positively in the expansion, while odd distinct partitions are counted negatively. Therefore, the coefficients in the expansion are the difference between these two counts. That is:
Next, we explain that in most cases, these two counts are equal, resulting in a coefficient of \(0\) in the expansion; only in a few positions do the counts differ by \(1\) or \(-1\).
We can use a constructive correspondence here.
Draw the Ferrers diagram for each distinct partition. The last row is called the bottom of the diagram, and the number of dots in the bottom is denoted by \(b\) (Bottom); the longest 45-degree line segment connecting the last dot of the top row to some dot in the diagram is called the slide of the diagram, and the number of dots on the slide is denoted by \(s\) (Slide).

To construct a correspondence between even distinct partitions and odd distinct partitions, we need to define transformations that change the number of rows by \(1\) while preserving the distinctness condition:
Transformation A: When \(b\) is less than or equal to \(s\), move the bottom to the right to become a new slide.
Transformation B: When \(b\) is greater than \(s\), move the slide down to become a new bottom.
For most distinct partitions of most \(n\), exactly one of these transformations can be applied, establishing a one-to-one correspondence between even distinct partitions and odd distinct partitions. Since the two parts in correspondence have equal counts, the coefficient of the \(n\)-th term in the expansion is \(0\).
However, for certain \(n\), there exists exactly one distinct partition for which neither transformation can be applied.
- Case 1: When \(b=s\) and the bottom and slide share a common point, Transformation A cannot be applied. Then
The \(n\)-th term in the expansion relates to the parity of the number of parts, and is \((-1)^s x^n\).
- Case 2: When \(b=s+1\) and the bottom and slide share a common point, Transformation B cannot be applied. Then
The \(n\)-th term in the expansion is \((-1)^s x^n\).
Replacing \(s\) with \(-s\) in the above formula gives \(n=\frac{s(3s-1)}{2}\), where \(s\) is a negative integer, and the \(n\)-th term in the expansion is still \((-1)^s x^n\).
Since the two cases cannot occur for the same \(n\) simultaneously, we can combine the conditions to get the condition that \(n\) must satisfy:
Thus, we have proved:
Recall: This expression is the reciprocal of the generating function for partition numbers, so multiplying it with the generating function for partition numbers yields \(1\). Comparing coefficients on both sides after rearrangement gives the recurrence relation for the partition number sequence.
This recurrence has infinitely many terms, but if we define the partition number for negative numbers as \(0\) (the partition number for \(0\) is already defined as \(1\)), it simplifies to a finite recurrence.
Example
Compute Partition Number
Compute the partition number \(p_n\). Multiple inputs, where the upper bound for \(n\) is \(50000\), modulo \(1000007\).
Use the Pentagonal Number Theorem method. Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
本页面最近更新:,更新历史
发现错误?想一起完善? 在 GitHub 上编辑此页!
本页面贡献者:OI-wiki
本页面的全部内容在 CC BY-SA 4.0 和 SATA 协议之条款下提供,附加条款亦可能应用