Partitions of Integers

How many ways can 10 identical coins be split into stacks, ignoring the order of the stacks? This is the question of partitioning an integer. It turns out to be one of the most stubbornly beautiful problems in enumerative combinatorics. Unlike compositions (ordered sums), partitions have no closed elementary formula. For compositions, a simple stars-and-bars count from Combinations with Repetition settles everything. The number of partitions of nn grows in a way that resisted a clean description for over a century. Hardy and Ramanujan eventually found its asymptotic shape. The subject matters because partitions sit at a crossroads. They are combinatorial objects, drawn as Ferrers diagrams. They are also number-theoretic objects, governed by generating functions built from infinite products. And they are analytic objects, whose growth rate connects to modular forms. The single richest tool for taming them is the generating function. This is a direct descendant of the Ordinary Generating Functions machinery. Here, though, it is pushed into infinite products. This differs from the finite rational functions typical of simpler counting problems. The big picture is simple to state. A partition-counting question — how many partitions of nn have only odd parts? only distinct parts? at most kk parts? — nearly always translates into a manipulation. That manipulation involves an infinite product ∏(1−xai)−1\prod (1-x^{a_i})^{-1} or its variants. Many identities look like deep coincidences. One example is Euler's theorem: partitions into odd parts and partitions into distinct parts are equinumerous. Such identities become one-line algebraic facts about these products. They are provable rigorously, without any hidden combinatorial gymnastics. This article builds the theory from the definition of a partition and its Ferrers diagram. It develops the generating function calculus. It proves Euler's odd/distinct theorem in full rigor via a bijection. It closes with the machinery's reach into modern combinatorics. This includes the doorway it opens to The Twelvefold Way, the unifying classification of counting problems about distributing objects into boxes.

Key takeaways
  • A partition of nn is a multiset of positive integers ("parts") summing to nn; order does not matter.
  • Ferrers (Young) diagrams turn partitions into rows of dots, making structural bijections visible.
  • The generating function for p(n)p(n), the number of partitions of nn, is the infinite product ∏k≥1(1−xk)−1\prod_{k\ge1}(1-x^k)^{-1}.
  • Restricting part sizes or multiplicities corresponds exactly to restricting factors in the product.
  • Euler's theorem: partitions into odd parts ↔\leftrightarrow partitions into distinct parts, in equal number for every nn.
  • Key idea: encoding a whole family of counting problems as one formal power series turns hard combinatorics into product/series algebra.

Where this lives today

Partition theory is not a museum piece; its generating-function calculus recurs across mathematics and its applications. In number theory, congruences of p(n)p(n) modulo small primes (Ramanujan's congruences p(5k+4)≡0(mod5)p(5k+4)\equiv 0 \pmod 5, etc.) connect partitions to modular forms and the theory of qq-series. In representation theory and algebra, partitions index the irreducible representations of the symmetric group SnS_n and the conjugacy classes of SnS_n simultaneously, via Young diagrams, linking directly to the classification ideas that culminate in The Twelvefold Way. In statistical mechanics and physics, partition generating functions appear as partition functions (not coincidentally named) for bosonic systems, since occupation numbers of energy levels behave exactly like unrestricted part multiplicities. In computer science, partition-counting recurrences underlie algorithms for integer partition enumeration used in combinatorial optimization, cryptographic parameter counting, and in analyzing recursive data structures. In probability and statistics, random partitions (e.g. under the Plancherel measure) model random growth processes and connect to the Robinson–Schensted–Knuth correspondence, an advanced extension of the same Ferrers-diagram combinatorics introduced here.

Ask the tutor: Can you show me how to derive Euler's pentagonal number theorem and use it to build a fast recurrence for p(n)p(n)?

DefinitionInteger Partition

A partition of a positive integer nn is a finite non-increasing sequence of positive integers

λ=(λ1≥λ2≥⋯≥λk>0)\lambda = (\lambda_1 \ge \lambda_2 \ge \cdots \ge \lambda_k > 0)

such that λ1+λ2+⋯+λk=n\lambda_1 + \lambda_2 + \cdots + \lambda_k = n. Each λi\lambda_i is called a part, and kk is the number of parts. Two sequences that differ only in the order of their terms represent the same partition (a partition is really an unordered multiset of positive integers with a given sum, written in canonical non-increasing order for convenience). The number of partitions of nn is denoted p(n)p(n), with the convention p(0)=1p(0) = 1 (the empty partition, with zero parts, is the unique partition of 00). More generally, for a set S⊆Z>0S \subseteq \mathbb{Z}_{>0} of allowed part sizes, pS(n)p_S(n) denotes the number of partitions of nn using only parts from SS; if repetition of a part is restricted (e.g. parts must be distinct, or each part size used at most rr times), this is stated explicitly as a variant, e.g. q(n)q(n) for partitions of nn into distinct parts. A Ferrers diagram (equivalently, Young diagram) of λ=(λ1,…,λk)\lambda = (\lambda_1,\dots,\lambda_k) is an array of left-justified rows of dots (or unit boxes), with row ii containing λi\lambda_i dots, rows stacked top to bottom in non-increasing length. The conjugate partition λ′\lambda' is obtained by reading the diagram's columns as rows, i.e. λj′=#{i:λi≥j}\lambda'_j = \#\{i : \lambda_i \ge j\}.

Intuition

A partition of nn answers "in how many essentially different ways can nn identical objects be grouped into piles?" Because piles have no names or order, 4=3+1=2+2=2+1+1=1+1+1+14 = 3+1 = 2+2 = 2+1+1 = 1+1+1+1 gives p(4)=5p(4) = 5 (including 44 itself as a single pile). Contrast this with compositions of 44, which count ordered sequences of positive parts summing to 44; there are 23=82^{3} = 8 of those, since between each pair of the 44 unit gaps we choose whether to cut. Partitions are the "unordered" cousin, and losing the order is exactly why no simple binomial-coefficient formula survives — the symmetry group SkS_k acting on parts has size depending on how many parts repeat, and this varies wildly from partition to partition. The Ferrers diagram makes this structure visual, and reveals hidden symmetries instantly. Flipping a diagram across its main diagonal swaps rows and columns, turning a partition λ\lambda into its conjugate λ′\lambda'; this single geometric operation proves, with no further work, that the number of partitions of nn into at most kk parts equals the number of partitions of nn with largest part at most kk — a fact that would be painful to verify by brute enumeration for large nn. Generating functions give an entirely different, algebraic, mental picture. Think of building a partition by deciding, for each possible part size k=1,2,3,…k = 1, 2, 3, \dots, how many times kk appears. The choices are independent across different values of kk, so the generating function factors as an infinite product, one factor per part size, each factor itself an ordinary generating function (from Ordinary Generating Functions) for "how many copies of kk to include."

Figure
Ferrers diagram of (5,3,3,1) and its conjugate (4,3,3,1,1)
λ = (5,3,3,1), n = 12 λ' = (4,3,3,1,1) (transpose) Reflect across the diagonal: rows of λ become columns of λ'. Largest part of λ (=5) = number of parts of λ' (=5 rows? no, 4 rows shown)
TheoremEuler's Generating Function for Partitions

Let S⊆Z>0S \subseteq \mathbb{Z}_{>0} be any set of allowed part sizes, and let pS(n)p_S(n) denote the number of partitions of nn using parts only from SS (with unlimited repetition of each allowed part, and pS(0)=1p_S(0)=1). Then, as formal power series in xx,

∑n=0∞pS(n) xn  =  ∏k∈S11−xk.\sum_{n=0}^{\infty} p_S(n)\, x^n \;=\; \prod_{k \in S} \frac{1}{1 - x^k}.

In particular, taking S=Z>0S = \mathbb{Z}_{>0}, the ordinary generating function for p(n)p(n) is

P(x):=∑n=0∞p(n)xn=∏k=1∞11−xk.P(x) := \sum_{n=0}^\infty p(n) x^n = \prod_{k=1}^{\infty} \frac{1}{1-x^k}.
Proof

We work in the ring of formal power series Z[[x]]\mathbb{Z}[[x]], where an infinite product ∏k∈S(1−xk)−1\prod_{k \in S}(1-x^k)^{-1} is well-defined as a formal power series provided that for every fixed exponent nn, only finitely many factors contribute a nonzero coefficient to xnx^n — a mild convergence condition automatically satisfied here since the factor (1−xk)−1=1+xk+x2k+⋯(1-x^k)^{-1} = 1 + x^k + x^{2k} + \cdots contributes nothing below degree kk, so only the factors with k≤nk \le n affect the coefficient of xnx^n. Hence the infinite product is really, for each fixed nn, a finite product computation, and the identity should be read coefficientwise.

Step 1: Expand each factor. For each k∈Sk \in S, geometric series in the formal power series ring gives

11−xk=∑mk=0∞xkmk,\frac{1}{1-x^k} = \sum_{m_k=0}^{\infty} x^{k m_k},

where mkm_k is a formal placeholder we interpret as "the number of times part kk is used." This is a valid formal power series identity because (1−xk)∑mk≥0xkmk=1(1-x^k)\sum_{m_k \ge 0} x^{km_k} = 1, checked by multiplying out and observing all terms telescope except the constant term 11.

Step 2: Multiply the factors and interpret the product. By definition of the product of formal power series,

∏k∈S11−xk=∏k∈S(∑mk=0∞xkmk)=∑(mk)k∈Sx∑k∈Sk mk,\prod_{k \in S} \frac{1}{1-x^k} = \prod_{k \in S}\left(\sum_{m_k=0}^\infty x^{k m_k}\right) = \sum_{(m_k)_{k \in S}} x^{\sum_{k \in S} k \, m_k},

where the sum on the right ranges over all functions (mk)k∈S(m_k)_{k\in S} from SS to Z≥0\mathbb{Z}_{\ge 0} that are eventually zero (equivalently, finitely supported, i.e. mk=0m_k = 0 for all but finitely many kk) — this finiteness is forced because we are forming a formal power series, and any nonzero coefficient of xnx^n can only receive contributions from choices with ∑kmk=n<∞\sum k m_k = n < \infty, hence only finitely many mkm_k can be nonzero in any single contributing term. This finite-support condition is precisely what makes the infinite product converge formally, matching Step 1's factor-by-factor validity.

Step 3: Identify the coefficient of xnx^n. By Step 2, the coefficient of xnx^n in ∏k∈S(1−xk)−1\prod_{k\in S}(1-x^k)^{-1} equals the number of finitely-supported functions (mk)k∈S(m_k)_{k \in S} with ∑k∈Sk mk=n\sum_{k \in S} k\, m_k = n.

Step 4: Bijection with partitions. There is a bijection between such functions (mk)k∈S(m_k)_{k\in S} and partitions of nn into parts from SS: given (mk)(m_k), form the partition consisting of mkm_k copies of the part kk for each k∈Sk \in S with mk>0m_k > 0, arranged in non-increasing order; conversely, given a partition of nn into parts from SS, let mkm_k be the number of times kk occurs as a part. These two maps are mutually inverse (both simply record "multiplicity of each part size"), so they establish a bijection between the finitely-supported solutions of ∑kmk=n\sum k m_k = n and partitions of nn using parts from SS.

Conclusion. Combining Steps 3 and 4, the coefficient of xnx^n in ∏k∈S(1−xk)−1\prod_{k \in S} (1-x^k)^{-1} equals exactly pS(n)p_S(n), the number of partitions of nn with parts in SS, for every n≥0n \ge 0. Since two formal power series with equal coefficients at every degree are equal, this proves

∑n≥0pS(n)xn=∏k∈S11−xk.\sum_{n \ge 0} p_S(n) x^n = \prod_{k \in S} \frac{1}{1-x^k}.

Taking S=Z>0S = \mathbb{Z}_{>0} gives the stated formula for P(x)P(x). ■\blacksquare

∎
LemmaGenerating Function for Distinct Parts

Let q(n)q(n) denote the number of partitions of nn into distinct parts (each part size used at most once), with q(0)=1q(0)=1. Then

∑n=0∞q(n)xn=∏k=1∞(1+xk).\sum_{n=0}^\infty q(n) x^n = \prod_{k=1}^{\infty} (1 + x^k).
Proof

The proof mirrors the previous theorem, but each part size kk may now be used 00 or 11 times only, so its individual generating function is 1+xk1 + x^k (choose "not included," contributing x0x^0, or "included once," contributing xkx^k) rather than the full geometric series ∑mxkm\sum_m x^{km}. Exactly as in Step 2 above, multiplying these factors over all k≥1k \ge 1 and extracting the coefficient of xnx^n counts finitely-supported choice functions ϵ:Z>0→{0,1}\epsilon: \mathbb{Z}_{>0} \to \{0,1\} with ∑kk ϵ(k)=n\sum_k k\,\epsilon(k) = n, which biject with partitions of nn into distinct parts (namely the parts kk with ϵ(k)=1\epsilon(k)=1) by the identical multiplicity-recording argument. ■\blacksquare

∎
TheoremEuler's Odd–Distinct Theorem

For every n≥0n \ge 0, the number of partitions of nn into parts that are all odd equals the number of partitions of nn into parts that are all distinct.

Proof

We give two independent proofs: an algebraic one via generating functions (in the spirit of the results above), and an explicit bijective one, since the theorem is a flagship example of both techniques working in harmony.

Proof 1 (generating functions). Let Odd={1,3,5,7,… }\mathrm{Odd} = \{1,3,5,7,\dots\}. By the first theorem applied with S=OddS = \mathrm{Odd}, the generating function for partitions into odd parts is

O(x)=∏j=0∞11−x2j+1.O(x) = \prod_{j=0}^\infty \frac{1}{1-x^{2j+1}}.

By the lemma, the generating function for partitions into distinct parts is

Q(x)=∏k=1∞(1+xk).Q(x) = \prod_{k=1}^\infty (1+x^k).

We show O(x)=Q(x)O(x) = Q(x) as formal power series. First factor each term 1+xk1+x^k using the algebraic identity 1+xk=1−x2k1−xk1+x^k = \frac{1-x^{2k}}{1-x^k} (valid since (1−xk)(1+xk)=1−x2k(1-x^k)(1+x^k) = 1-x^{2k} in any commutative ring, in particular Z[[x]]\mathbb{Z}[[x]]). Hence

Q(x)=∏k=1∞1−x2k1−xk.Q(x) = \prod_{k=1}^\infty \frac{1-x^{2k}}{1-x^k}.

Consider the truncated product QN(x)=∏k=1N1−x2k1−xkQ_N(x) = \prod_{k=1}^N \frac{1-x^{2k}}{1-x^k}. Split the denominator's index set {1,…,N}\{1,\dots,N\} into odd and even indices:

∏k=1N(1−xk)=∏1≤k≤Nk odd(1−xk)⋅∏1≤k≤Nk even(1−xk)=∏1≤k≤Nk odd(1−xk)⋅∏j=1⌊N/2⌋(1−x2j).\prod_{k=1}^N (1-x^k) = \prod_{\substack{1\le k \le N\\ k \text{ odd}}} (1-x^k) \cdot \prod_{\substack{1 \le k \le N \\ k \text{ even}}} (1-x^k) = \prod_{\substack{1\le k\le N\\ k \text{ odd}}}(1-x^k)\cdot \prod_{j=1}^{\lfloor N/2\rfloor} (1-x^{2j}).

Therefore

QN(x)=∏j=1N(1−x2j)∏1≤k≤Nk odd(1−xk)⋅∏j=1⌊N/2⌋(1−x2j).Q_N(x) = \frac{\prod_{j=1}^{N} (1-x^{2j})}{\prod_{\substack{1\le k\le N\\ k\text{ odd}}}(1-x^k) \cdot \prod_{j=1}^{\lfloor N/2\rfloor}(1-x^{2j})}.

The factors ∏j=1⌊N/2⌋(1−x2j)\prod_{j=1}^{\lfloor N/2 \rfloor}(1-x^{2j}) appearing in the denominator cancel against the matching initial segment of ∏j=1N(1−x2j)\prod_{j=1}^N(1-x^{2j}) in the numerator, leaving

QN(x)=∏j=⌊N/2⌋+1N(1−x2j)∏1≤k≤Nk odd(1−xk).Q_N(x) = \frac{\prod_{j=\lfloor N/2\rfloor + 1}^{N} (1-x^{2j})}{\prod_{\substack{1\le k\le N \\ k \text{ odd}}} (1-x^k)}.

As formal power series, we take N→∞N \to \infty coefficientwise: fix any degree dd. Once NN is large enough that 2(⌊N/2⌋+1)>d2(\lfloor N/2\rfloor+1) > d, every factor in the remaining numerator product ∏j=⌊N/2⌋+1N(1−x2j)\prod_{j=\lfloor N/2\rfloor+1}^N(1-x^{2j}) contributes only terms of degree >d> d beyond the constant term 11, so this numerator product is ≡1(modxd+1)\equiv 1 \pmod {x^{d+1}}. Hence, modulo xd+1x^{d+1},

QN(x)≡∏k odd,k≤N11−xk(modxd+1),Q_N(x) \equiv \prod_{\substack{k \text{ odd}, \, k \le N}} \frac{1}{1-x^k} \pmod{x^{d+1}},

and letting N→∞N \to \infty (all sufficiently large odd k>dk > d also become irrelevant mod xd+1x^{d+1}) gives Q(x)≡O(x)(modxd+1)Q(x) \equiv O(x) \pmod{x^{d+1}}. Since dd was arbitrary, every coefficient of Q(x)Q(x) equals the corresponding coefficient of O(x)O(x), i.e. Q(x)=O(x)Q(x) = O(x) as formal power series. By the theorem and lemma above, the coefficients of Q(x)Q(x) and O(x)O(x) are exactly q(n)q(n) and (the odd-part count) respectively, so these two counting functions agree for every nn.

Proof 2 (explicit bijection, Glaisher's map). Given a partition λ\lambda of nn into odd parts, write each distinct odd value vv occurring with multiplicity mvm_v using its binary expansion mv=2a1+2a2+⋯+2arm_v = 2^{a_1} + 2^{a_2} + \cdots + 2^{a_r} (distinct powers of 22, guaranteed uniquely by binary representation). Replace the mvm_v copies of vv by the parts 2a1v,2a2v,…,2arv2^{a_1} v, 2^{a_2} v, \dots, 2^{a_r} v. These new parts sum to mv⋅vm_v \cdot v, so the total sum nn is preserved. All resulting parts across all distinct odd vv are pairwise distinct: two parts 2av2^a v and 2bw2^b w (for odd v≠wv \ne w or a≠ba \ne b) coincide only if v=wv=w and a=ba=b by uniqueness of factoring an integer into an odd part times a power of 22 (every positive integer mm factors uniquely as m=2avm = 2^a v with vv odd, a≥0a \ge 0). Hence this map sends a partition into odd parts to a partition into distinct parts. Conversely, given a partition μ\mu into distinct parts, write each part μi\mu_i uniquely as μi=2aivi\mu_i = 2^{a_i} v_i with viv_i odd (existence and uniqueness of this factorization is the standard fact that every positive integer has a unique odd part after removing all factors of 22). Group parts of μ\mu by their odd component vv, and for each such vv, if the powers of two occurring are 2a1,…,2ar2^{a_1}, \dots, 2^{a_r} (necessarily distinct since the μi=2aiv\mu_i = 2^{a_i}v are themselves distinct for fixed vv), replace this group by mv=2a1+⋯+2arm_v = 2^{a_1}+\cdots+2^{a_r} copies of the odd part vv. This produces a partition into odd parts summing to the same nn. These two constructions are mutually inverse: starting from an odd-parts partition, splitting each multiplicity into binary powers and then regrouping by odd value exactly reconstructs the original multiplicities, since binary representation is unique; starting from a distinct-parts partition, factoring out odd cores and regrouping, then re-splitting via binary expansion of the resulting multiplicity, recovers the original distinct parts, again by uniqueness of binary representation. Hence Glaisher's map is a bijection between partitions of nn into odd parts and partitions of nn into distinct parts, for every nn, proving the theorem constructively. ■\blacksquare

∎

Worked examples

Example 1: partitions of n=8n = 8 into parts of size at most 33, computed two ways. By the Euler generating function theorem with S={1,2,3}S = \{1,2,3\},

∑np{1,2,3}(n) xn=1(1−x)(1−x2)(1−x3).\sum_n p_{\{1,2,3\}}(n)\, x^n = \frac{1}{(1-x)(1-x^2)(1-x^3)}.

We extract the coefficient of x8x^8 directly via convolution rather than trusting a memorized formula. Write 11−x2=∑jx2j\frac{1}{1-x^2} = \sum_j x^{2j} and 11−x3=∑kx3k\frac{1}{1-x^3} = \sum_k x^{3k}; multiplying these two gives ∑mcmxm\sum_m c_m x^m where cm=#{(j,k):2j+3k=m, j,k≥0}c_m = \#\{(j,k) : 2j+3k = m,\ j,k \ge 0\}. Then multiplying by 11−x=∑ixi\frac{1}{1-x}=\sum_i x^i gives the coefficient of x8x^8 as

p{1,2,3}(8)=∑m=08cm,p_{\{1,2,3\}}(8) = \sum_{m=0}^{8} c_m,

since each unit of "leftover" degree 8−m8-m is absorbed by choosing i=8−mi = 8-m parts equal to 11. Compute cmc_m for m=0,…,8m=0,\dots,8 by listing (j,k)(j,k) with 2j+3k=m2j+3k=m:

  • m=0m=0: (0,0)(0,0) → c0=1c_0=1
  • m=1m=1: none → c1=0c_1=0
  • m=2m=2: (1,0)(1,0) → c2=1c_2=1
  • m=3m=3: (0,1)(0,1) → c3=1c_3=1
  • m=4m=4: (2,0)(2,0) → c4=1c_4=1
  • m=5m=5: (1,1)(1,1) → c5=1c_5=1
  • m=6m=6: (3,0),(0,2)(3,0),(0,2) → c6=2c_6=2
  • m=7m=7: (2,1)(2,1) → c7=1c_7=1
  • m=8m=8: (4,0),(1,2)(4,0),(1,2) → c8=2c_8=2

Sum: 1+0+1+1+1+1+2+1+2=101+0+1+1+1+1+2+1+2 = 10. So p{1,2,3}(8)=10p_{\{1,2,3\}}(8) = 10.

Cross-check by direct enumeration. Partitions of 88 with all parts ≤3\le 3: 3+3+23+3+2, 3+3+1+13+3+1+1, 3+2+2+13+2+2+1, 3+2+1+1+13+2+1+1+1, 3+1+1+1+1+13+1+1+1+1+1, 2+2+2+22+2+2+2, 2+2+2+1+12+2+2+1+1, 2+2+1+1+1+12+2+1+1+1+1, 2+162+1^6, 181^8. That is 1010 partitions, matching the generating-function computation exactly.

Example 2: verifying Euler's odd–distinct theorem at n=12n = 12, including the explicit Glaisher bijection on one instance. First enumerate partitions of 1212 into distinct parts (parts pairwise different): 1212; 11+111+1; 10+210+2; 9+39+3; 8+48+4; 7+57+5; 9+2+19+2+1; 8+3+18+3+1; 7+4+17+4+1; 6+5+16+5+1; 7+3+27+3+2; 6+4+26+4+2; 5+4+35+4+3; 6+3+2+16+3+2+1; 5+4+2+15+4+2+1. Counting these, we get 1515 partitions (one should check no duplicates and no omissions: distinct-part partitions of 1212 are classically known to number 1515). Now enumerate partitions of 1212 into odd parts: 11+111+1; 9+39+3; 9+1+1+19+1+1+1; 7+57+5; 7+3+1+17+3+1+1; 7+157+1^5; 5+5+1+15+5+1+1; 5+3+3+15+3+3+1; 5+3+145+3+1^4; 5+175+1^7; 3+3+3+33+3+3+3; 3+3+3+1+1+13+3+3+1+1+1; 3+3+163+3+1^6; 3+193+1^9; 1121^{12}. That is 1515 partitions. Both counts equal 1515, matching the theorem, i.e. q(12)=15q(12) = 15 and the odd-part count is also 1515. Now trace Glaisher's map on the odd-part partition 5+3+3+15+3+3+1 of 1212. Group by distinct odd value: value 55 has multiplicity 1=201 = 2^0, contributing part 20⋅5=52^0 \cdot 5 = 5. Value 33 has multiplicity 2=212 = 2^1, contributing part 21⋅3=62^1\cdot 3 = 6. Value 11 has multiplicity 1=201 = 2^0, contributing part 20⋅1=12^0 \cdot 1 = 1. The image is the distinct-parts partition 6+5+16+5+1, which sums to 1212 as required, and indeed 6+5+16+5+1 appears in our list of distinct-part partitions above. Running the inverse map on 6+5+16+5+1: factor 6=21⋅36 = 2^1\cdot 3 (odd core 33, power 212^1), 5=20⋅55=2^0\cdot 5 (odd core 55, power 202^0), 1=20⋅11 = 2^0 \cdot 1 (odd core 11, power 202^0); regrouping by odd core gives multiplicity 22 for value 33 (from exponent 11, i.e. 21=22^1=2 copies) and multiplicity 11 for values 55 and 11, exactly recovering 5+3+3+15+3+3+1.

CounterexampleWhy "unlimited repetition of each part" cannot be dropped in the basic generating function theorem

The theorem ∑npS(n)xn=∏k∈S(1−xk)−1\sum_n p_S(n) x^n = \prod_{k\in S}(1-x^k)^{-1} crucially assumes each allowed part size may be repeated any number of times. If instead we cap the number of times a part may be used — say, part size kk may be used at most once for every kk — the correct generating function is ∏k∈S(1+xk)\prod_{k\in S}(1+x^k) as in the distinct-parts lemma, not ∏k∈S(1−xk)−1\prod_{k\in S}(1-x^k)^{-1}. Concretely, take S={1,2}S = \{1,2\} with the unrestricted theorem's formula:

1(1−x)(1−x2)=1+x+2x2+2x3+3x4+⋯ ,\frac{1}{(1-x)(1-x^2)} = 1 + x + 2x^2 + 2x^3 + 3x^4 + \cdots,

so the (correct, unrestricted) theorem predicts p{1,2}(3)=2p_{\{1,2\}}(3) = 2: indeed 3=1+1+1=1+23 = 1+1+1 = 1+2. But if we impose the extra restriction "each part used at most once" without changing which generating function we use, we would wrongly also claim 22 partitions of 33 using distinct parts from {1,2}\{1,2\}; the truth is there is only one: 1+21+2 (since 1+1+11+1+1 repeats the part 11 three times, which is disallowed once repetition is capped). The correct generating function under this restriction is (1+x)(1+x2)=1+x+x2+x3(1+x)(1+x^2) = 1 + x + x^2 + x^3, whose coefficient of x3x^3 is 11, matching direct enumeration — not 22. This shows that silently reusing the unrestricted-repetition generating function once the "unlimited repetition" hypothesis has been dropped produces a numerically wrong answer, confirming that hypothesis is load-bearing rather than decorative.

Scope, edge cases & common traps

SituationWhat to useCommon mistake
Parts from SS, unlimited repeats∏k∈S(1−xk)−1\prod_{k\in S}(1-x^k)^{-1}Applying this when repeats are actually capped
Parts from SS, each used ≤1\le 1 time∏k∈S(1+xk)\prod_{k\in S}(1+x^k)Confusing with the unrestricted product above
Parts from SS, each used ≤r\le r times∏k∈S1−x(r+1)k1−xk\prod_{k\in S}\frac{1-x^{(r+1)k}}{1-x^k}Forgetting to truncate the geometric series
Exactly kk parts (not "at most")Coefficient extraction needs the conjugate/Ferrers argument, not a bare productAssuming a simple product tracks part-count directly
p(0)p(0)Defined as 11 (empty partition)Treating p(0)=0p(0)=0, which breaks the generating function's constant term

The mathematician behind it

Origins · 1 minLeonhard Euler and how this was discovered
LE
Leonhard Euler
1707–1783 · 18th-century analysis and combinatorics, University of Basel / St. Petersburg / Berlin Academies

Euler initiated the systematic study of integer partitions in the 1740s while investigating problems posed by Philipp Naudé about representing numbers as sums. He was the first to realize that the generating function ∏k(1−xk)−1\prod_k (1-x^k)^{-1} could serve as a bookkeeping device for partition counts, effectively inventing the formal power series method for combinatorial enumeration used throughout this article. His pentagonal number theorem, giving the sparse expansion of ∏k(1−xk)\prod_k(1-x^k), remains one of the most striking identities in the field and underlies efficient recursive computation of p(n)p(n).

History
- 1740: Philipp Naudé writes to Euler asking for the number of ways to write 5050 as a sum of 77 distinct positive integers.
- 1748: Euler's Introductio in analysin infinitorum develops generating functions for partitions and proves the odd–distinct theorem.
- 1750s: Euler discovers the pentagonal number theorem, ∏k≥1(1−xk)=∑j=−∞∞(−1)jxj(3j−1)/2\prod_{k\ge1}(1-x^k) = \sum_{j=-\infty}^\infty (-1)^j x^{j(3j-1)/2}.
- 1881: James Whitbread Lee Glaisher publishes the explicit bijective proof of Euler's odd–distinct theorem used above.
- 1918: G. H. Hardy and Srinivasa Ramanujan derive the asymptotic formula p(n)∼14n3eπ2n/3p(n) \sim \frac{1}{4n\sqrt3}e^{\pi\sqrt{2n/3}}, founding the circle method.
Why doesn't a simple closed formula like (n−1k−1)\binom{n-1}{k-1} exist for p(n)p(n), unlike compositions?

Compositions of nn into kk ordered positive parts correspond to choosing which of the n−1n-1 gaps between unit dots become "cuts," a direct stars-and-bars argument from Combinations with Repetition, giving the clean formula (n−1k−1)\binom{n-1}{k-1}. Partitions quotient this count by the symmetric group action that permutes parts, but different partitions have different-sized "orbits" (a partition with all distinct parts has orbit size k!k!, while one with many repeated parts has a much smaller orbit, by Burnside-type reasoning). Because this orbit size varies unpredictably with the partition's shape, no uniform formula analogous to dividing by k!k! survives; the best available exact tool is the generating function product, and the best explicit formula is Hardy–Ramanujan's asymptotic expansion, not an exact closed form.

Is the generating function identity P(x)=∏k(1−xk)−1P(x) = \prod_k (1-x^k)^{-1} valid as a statement about convergent real-number series, or only formally?

Both, though the article treats it formally to sidestep convergence subtleties. For ∣x∣<1|x| < 1, each factor (1−xk)−1(1-x^k)^{-1} converges absolutely, and one can show the infinite product converges to an analytic function on the open unit disk whose Taylor coefficients are exactly p(n)p(n); this requires an analytic convergence argument beyond the purely algebraic coefficient-matching given in the proof here. The formal power series viewpoint is preferred pedagogically because it makes no reference to convergence at all: equality of formal power series is just equality of every coefficient, which is exactly what the coefficient-extraction proof establishes, with no analysis required.

How does the Ferrers diagram conjugation trick generalize beyond the "largest part vs. number of parts" fact?

Conjugation is an involution ((λ′)′=λ(\lambda')' = \lambda) on the set of all partitions of nn, so it pairs up partitions and can be used to prove many "partitions with property X = partitions with property Y" theorems whenever X and Y are dual under transposition. For instance, partitions of nn with parts at most kk correspond under conjugation to partitions of nn with at most kk parts, and self-conjugate partitions (λ=λ′\lambda = \lambda') biject with partitions into distinct odd parts — a companion identity to Euler's theorem, provable by examining the "hook" structure of the diagonal in a self-conjugate diagram.

What is the relationship between partitions of nn and partitions of a set, as discussed in The Twelvefold Way?

They are different objects despite the shared name. An integer partition breaks the number nn into a multiset of positive integer parts; a set partition breaks an nn-element set into nonempty, unordered, disjoint blocks. However, they are linked: the shape (multiset of block sizes) of a set partition is exactly an integer partition of nn, and this shape statistic is one of the twelve fundamental counting problems organized in The Twelvefold Way, where "distributing nn distinguishable or indistinguishable balls into distinguishable or indistinguishable boxes" is classified systematically, with integer partitions appearing as the answer to the "indistinguishable balls, indistinguishable boxes" case.

Why does Euler's pentagonal number theorem matter if this article only proves the basic generating function theorem?

The pentagonal number theorem gives the reciprocal expansion ∏k(1−xk)=∑j(−1)jxj(3j−1)/2\prod_k(1-x^k) = \sum_j (-1)^j x^{j(3j-1)/2} (sum over all integers jj, giving a sparse series with mostly zero coefficients). Multiplying this sparse series by P(x)P(x) must give 11, since P(x)⋅∏k(1−xk)=1P(x)\cdot\prod_k(1-x^k)=1 by definition of P(x)P(x) as the reciprocal product; matching coefficients yields a recurrence expressing p(n)p(n) in terms of earlier values p(n−1),p(n−2),p(n−5),…p(n-1), p(n-2), p(n-5), \ldots at pentagonal-number offsets. This recurrence, not the raw infinite product, is how p(n)p(n) is efficiently computed by hand or by early computers, and it is the natural next tool built on top of the generating function established in this article's central theorem.

Does the theorem's proof require assuming xx is a "small" number, the way a convergent product argument would?

No. The entire proof is carried out inside the formal power series ring Z[[x]]\mathbb{Z}[[x]], where xx is a formal symbol, not a number subject to convergence constraints. The only analytic-looking step — "for fixed degree dd, all sufficiently large-index factors are eventually irrelevant modulo xd+1x^{d+1}" — is really a statement about polynomial truncation, not about numerical convergence, and it holds unconditionally for every formal power series ring regardless of what value (if any) xx is later substituted with.

Before this

Where this leads