Six numbers that need five pentagons
Worth reading first: Three triangular numbers, and no fewer · Every square is a stack of odd numbers.
Three triangular numbers, and no fewer began with a line from Gauss’s diary for 10 July 1796: num = Δ + Δ + Δ — every whole number is a sum of three triangular numbers. Gauss was proving one case of a much larger claim. In 1638 Pierre de Fermat wrote in a letter that every number is a sum of three triangular numbers, four squares, five pentagonal numbers, six hexagonal numbers, “and so on to infinity”, and that he had a remarkable proof which the margins of his letters were too narrow to hold.
Joseph-Louis Lagrange proved the four-square case in 1770; Gauss the triangular case in 1796. Augustin-Louis Cauchy proved the whole claim, every polygon at once, in 1813. So Fermat was right. But the statement “five pentagonal numbers suffice” conceals a question it does not ask: how often are all five actually needed?
The answer, in the figure, is almost never. The pentagonal numbers are . Most numbers up to are sums of two or three of them. Six numbers in the whole range examined, up to twenty thousand, need all five, and the last of them is . After that, four always suffice — and for most numbers far fewer.
A claim made in a letter
Fermat’s statement appears in a letter of September 1638 to Marin Mersenne, and again in the margin of his copy of Diophantus’s Arithmetica, the book whose margin also holds his most famous claim. Diophantus had discussed polygonal numbers in the third century, in a treatise of which a fragment survives, and Fermat described his result as among the most beautiful in all of arithmetic, promising a book on it that he never wrote.
Leonhard Euler spent years on the four-square case and proved a key step — that the product of two sums of four squares is again a sum of four squares, the identity behind the integers among the quaternions — without finishing it. Lagrange finished it in 1770, using Euler’s identity. Gauss’s triangular case, in 1796, needed his new theory of quadratic forms. And Cauchy’s general proof, in 1813, used both of the first two cases as tools. Every step of the proof leans on the squares, which is why the squares case had to come first.
What Fermat’s own proof was, if he had one, is unknown. His favourite method was infinite descent — showing that a counterexample would produce a smaller counterexample, and so on forever, which whole numbers cannot do — and he claimed to have used it for the four-square case. No descent proof of the general polygonal theorem has ever been found, and every proof since Cauchy’s goes through sums of squares instead. It is possible that Fermat had a proof of the cases he mentioned first and generalised by analogy, as he did elsewhere with claims that turned out to be false. Here, the analogy held.
Polygons of dots
The -gonal numbers count dots arranged in nested regular polygons with sides.
Start with one dot. Draw a pentagon of side one with that dot as a corner: five dots. Draw a pentagon of side two sharing the same corner, and add the dots on its three new sides: twelve. Each new shell adds the three sides that do not touch the shared corner, so the shells grow by three dots at a time, just as odd numbers are squares found the square numbers growing by odd numbers — the gnomon of a square is two sides, of a pentagon three. Every polygonal family is built by the same rule with a different number of new sides per shell, and so every family is a sequence of second differences constant at . The general formula is
which gives the triangular numbers at , the squares at , and the pentagonal numbers at . The figure checks each drawn pentagon against the formula, dot for dot.
Hexagonal numbers are built the same way with four new sides per shell: . They happen to be every other triangular number — the triangular numbers — because a hexagon of dots can be cut into triangles. The polygonal families are not independent of one another, and that interdependence is part of why the theorem has a single proof.
From triangles to octagons
The same count can be run for every kind of polygon, and the results sort themselves into two groups.
For triangular numbers, three are needed by more than half of all numbers up to twenty thousand: , , , and so on. For squares, four are needed by every number of the form — , , , , , … — a family that never ends, as Legendre’s three-square theorem says, and the integers among the quaternions proved that four always suffice.
Then the pattern changes. Pentagonal numbers need five only for the six numbers of the first figure. Hexagonal numbers need six only for and . Heptagonal numbers need seven only for and ; octagonal numbers need eight only for and . For triangles and squares Fermat’s bound is the truth for infinitely many numbers; for every larger polygon it is the truth for a few small ones and a gross overestimate for everything else.
Why the small cases are the hard ones
The reason the full count is needed only for small numbers from pentagons on is visible in the first few polygonal numbers themselves.
Consider hexagonal numbers: . To make from them, the largest usable is , leaving , which needs five ones: six hexagonal numbers in all, . There is no alternative, because nothing between and is hexagonal. Small numbers have few polygonal numbers below them, and the gap between and the next one, , forces up to ones. For larger numbers, many polygonal numbers are available, their sums cover the numbers densely, and the count drops.
The same arithmetic explains why triangles and squares behave differently. Their full counts are forced not by small gaps but by congruences: a sum of three squares can never be more than a multiple of , so every such number needs four, however large. Three triangular numbers suffice for every number but two do not, and the numbers that need three are forced by a similar condition on sums of two squares, which three triangular numbers, and no fewer translated. For pentagons and beyond, no congruence obstructs a sum of polygonal numbers, and only the small cases, with their gaps, need the full count.
The same two exceptions, every time
From hexagons on, the numbers that need all follow a formula. For hexagons they are and ; for heptagons and ; for octagons and . In each case they are and , and a search to twenty thousand confirms the same pair, and nothing else, for every polygon from six sides to thirteen.
Both are easy to account for. The two smallest -gonal numbers after are and . The number is too small to use , and using once leaves , which can only be made of ones: terms, and using no at all is worse. The number can be made as four copies of and ones, again terms in all; using instead leaves , which, as just seen, needs terms of its own. Every other number has a cheaper route, because once and larger polygonal numbers can be combined, the gaps that force long strings of ones close up.
For pentagons, and are two of the six exceptions. The other four — , , and — exist because the pentagonal numbers are packed more tightly at the start than those of larger polygons, and a few more small gaps survive. The pentagon is the transition case: the first polygon whose exceptions are finite, and the last whose exceptions are irregular.
How Cauchy proved it
Cauchy’s proof reduces every polygon to a statement about squares.
The key identity is that is a perfect square: . So representing a number as a sum of -gonal numbers is equivalent to representing a related number as a sum of squares with a condition on the numbers being squared. Cauchy’s lemma — that for odd and with and , there are four non-negative integers whose squares add to and which themselves add to — does the rest. The lemma handles the general with four squares and a controlled sum, and the remaining polygonal numbers in the count are ones and zeros used to adjust.
Melvyn Nathanson gave a short version of the proof in 1987, which fits on a page and explains why Fermat’s bound of is exactly what the lemma leaves room for: four terms from the lemma, and up to ones to correct the remainder. The bound is therefore not merely true but natural, and it is attained exactly for the small numbers the table shows.
Pentagons are squares in disguise
Cauchy’s identity is concrete enough to check by hand for pentagons. With it reads
so every pentagonal number is . Writing a number as a sum of five pentagonal numbers is therefore the same as writing as a sum of five squares, each of a number that is one less than a multiple of six, with allowed to contribute a square of .
Take the last of the six exceptions, . It is , five pentagonal numbers, and no fewer will do. On the other side of the identity, , and indeed , five squares of numbers of the form . The question about pentagons has become a question about squares with a congruence condition, and the theory of sums of squares is where every result about polygonal numbers is actually proved.
The same trick explains the six exceptions. A number that needs five pentagonal numbers is one for which cannot be written with fewer squares of the right kind — for small the right-kind squares, , are too sparse to combine in fewer ways, and as grows they become dense enough that four, and then three, always do.
Pentagons with negative sides
Euler met the pentagonal numbers somewhere else entirely. Expanding the infinite product , he found that almost every coefficient cancels, and the survivors sit exactly at the exponents — the pentagonal numbers — and the same formula at negative : . The terms that cancel almost everything followed that cancellation.
Together, the values of for all whole numbers , positive and negative, are the generalised pentagonal numbers: . With these, the pentagonal problem collapses: every number is a sum of three generalised pentagonal numbers, a fact that can be derived, with some care, from Gauss’s three-square theorem through the same identity, since allowing negative allows every number with either sign, and so every number not divisible by two or three. So the six stubborn exceptions of the ordinary pentagonal numbers are an artefact of forbidding the negative half of the family — the half that every partition hidden in a product needed to make its recurrence work.
Beyond the full count
Since only small numbers need all , a natural question is how many are needed by every large number. For pentagonal numbers the answer from computation is striking: numbers needing four become rarer and rarer — of them below a thousand, between a thousand and ten thousand, five between ten thousand and fifty thousand — and the last of them in a search to two hundred thousand is . Beyond it, three pentagonal numbers appear to suffice. Richard Guy surveyed these questions in 1994 under the title “Every number is expressible as the sum of how many polygonal numbers?”, and the answers are known in some cases and conjectured in others.
The structure is the same as in the question of Waring for powers: , the number needed for every number, is driven by small exceptions, while , the number needed for all sufficiently large numbers, is smaller and much harder to determine. For polygonal numbers, Fermat’s claim is the ; the is where the modern questions live.
What the grids and tables cannot show
The counts are exact up to twenty thousand. Each is the fewest polygonal numbers summing to the number, found by building the answers up from zero, so no number in the range is skipped and every stated exception is checked to be the only one in the range. Beyond twenty thousand, the claim that no further number needs all is a matter of proof, not of these figures.
Fermat’s claim is checked, not proved. The figures confirm that no number up to twenty thousand needs more than polygonal numbers of each kind; that none ever does is Cauchy’s theorem.
The pictures of dots are one arrangement of many. Polygonal numbers can be drawn centred rather than sharing a corner, which gives different numbers — the centred polygonal numbers — and a different set of questions.
Still open: whether three pentagons are enough after 33,066
The computations say that every number above is a sum of three pentagonal numbers, and they have been pushed far beyond the range drawn here without finding an exception. Whether it holds for every number is not known. The question has been asked since at least Richard Guy’s survey of 1994.
The difficulty is structural. Representing as a sum of three pentagonal numbers is, after Cauchy’s identity, representing a related number by a ternary quadratic form with conditions attached — and three-variable forms are exactly where the theory of representations stops being complete. For four variables, a finite check decides everything, as fifteen numbers decide every number describes. For three variables there can be sporadic exceptions scattered arbitrarily far out, and proving that a list of exceptions is finite and complete requires controlling them all. The same obstacle appears in Ramanujan’s form , whose odd exceptions are believed to end at and are proved to only on the assumption of a generalised Riemann hypothesis.
A bound that is sharp only at the start
The habit worth keeping is to ask where a bound is attained.
Fermat’s claim is sharp: polygonal numbers are needed, sometimes. For triangles and squares, sometimes means infinitely often, because a congruence forces it. For every larger polygon, sometimes means a handful of small numbers, forced by the gap between and the next polygonal number. The contrast is sharpest between four sides and five. A square number bound of four is forced forever by arithmetic modulo eight; a pentagonal bound of five is forced by nothing but the crowding of the first few pentagonal numbers, and it lapses for good at eighty-nine. The theorem is the same for every polygon, and its truth is completely different in character once the polygon has five sides — a worst case that lives in the first ninety numbers and never recurs.
What links here
Computed from the collection, not written here: the essays that point at this one.
Reads more easily once this is understood
Essays that name this one as worth reading first.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Sums of powers, read off a staircase — both name figurate numbers, triangular numbers
Named objects
A dashed tag is an object no other essay names yet.
Exhaustive searchFigurate numbersGnomonQuadratic formSum of squaresTriangular numbers