◀ THE FOLD0ROOT.AI // WORLD II · LOOT · THE STASH◆ .dlw.fold
THE FOLD / LOOT / THE STASH / THE PENTAGONAL

THE PENTAGONAL

partitions counted by an alternating sum over pentagons
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Euler’s pentagonal number theorem gives a shockingly efficient recurrence for p(n), the number of ways to write n as a sum of positive integers. Naively p(n) explodes, but Euler found that the generating product ∏(1-xk) collapses to a sparse alternating sum over the generalized pentagonal numbers gk = k(3k-1)/2 — 1, 2, 5, 7, 12, 15, 22, … That yields p(n) = p(n-1) + p(n-2) - p(n-5) - p(n-7) + p(n-12) + …, signs in pairs of plus-plus, minus-minus, using only O(√n) terms. It is one of the most beautiful cancellations in all of combinatorics.

LIT verified live: for n up to 45 the pentagonal-number recurrence produces exactly the same partition counts as a brute dynamic-programming enumeration — p(40) = 37338, p(45) = 89134 (window.__pentagonal). FIG no framing; the pentagonal recurrence and the brute partition count both run in-browser and agree exactly.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-stash — every way to break a stash of n into piles, counted not by listing them but by an alternating sum that skips across pentagonal gaps. AVAN (AI) built the instrument: the generalized-pentagonal recurrence, the brute partition DP, and their exact agreement.

Credit as content: Leonhard Euler (1740s). The weave: David names the stash; I confirm the sparse alternating pentagonal sum reproduces every partition count.
3 ONE DIMENSION
The partition counts p(n) growing; the pentagonal numbers 1,2,5,7,12,… mark which earlier terms the recurrence reaches back to.
4 TWO DIMENSIONS · INTERACTIVE
Cycle n; the pentagonal ± recurrence for p(n) is shown term by term and matched against the brute count.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: p(n), the count of partitions of n.
AVAN’s addition (the inverse-companion): don’t enumerate the partitions — cancel the generating product. The inverse of ‘count the partitions of n’ is ‘the alternating pentagonal sum p(n-1)+p(n-2)-p(n-5)-…’, the reciprocal of ∏(1-xk). Magenta are the alternating ± pentagonal terms; green is the partition count they sum to. Counting by cancellation.
LIT Genuine Euler pentagonal number theorem (Leonhard Euler, 1740s). Verified live: for n=0..45 the generalized-pentagonal recurrence p(n)=Σ_k(−1)^{k−1}[p(n−g_k)+p(n−g_k')] with g_k=k(3k∓1)/2 produces exactly the brute dynamic-programming partition counts — p(40)=37338, p(45)=89134 (window.__pentagonal.ok, .p40, .p45).

FIG No framing; the pentagonal recurrence and the brute partition count both run in-browser and agree exactly. The AVAN inverse is honest — instead of enumerating the partitions, cancel the generating product: the alternating pentagonal sum is the reciprocal of ∏(1−xᵏ). Magenta are the alternating ± pentagonal terms; green is the partition count they sum to. Counting by cancellation.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE STASH · David Lee Wise (ROOT0), with AVAN