Counting with Polygons

by Jonathan Kujawa

Count von Count [0]
When I was in first grade we learned to count to 100. We counted by ones, but also by twos, fives, and tens (2, 4, 6, 8, …, or 5, 10, 15, 20, …, or 10, 20, 30,…). On the plus side, this is handy when you want to count to large numbers.

But even my teacher would admit that’s not much of an upside. Certainly, I was more motivated by the sticker you got for hitting 100 than the counting itself.

Another downside is that you can’t count to every number. If you need to count to sixteen, you can do it with twos, but not fives or tens. This is fixable, though. We just need to agree that 1 can be included when we count, regardless of how we are counting. Then counting by fives turns into 16 = 15 + 1 or 16 = 10 + 1 + 1 + 1 + 1 + 1 + 1. If it makes you feel better, you can think of 1 as a sort of degenerate two, five, and ten.

With 1 in hand, we can count to any number we like, so the question becomes what are the fewest numbers we could use? To count to seven using twos, you could do it as 7 = 1+1+1+1+1+1 or 7=4+1+1+1, but plainly 7=6+1 is the smallest sum that works.  But that question is still rather dull, to be honest. It seems counting is unavoidably boring.

Or is it?

I’m bummed my math education never got around to some of the interesting ways to count.

For example, how about the square numbers:

1, 4, 9, 16, 25, 36, ….?

The first question is if you can even use these to count. That is, can you get to any number you like by adding up squares? Sure. Since we have 1, we can always just count by ones. The real question is if we can do better. In 1770 Lagrange proved that every natural number (that is, 0, 1, 2, 3, 4, 5, 6, 7, …) can be written as a sum of four or fewer squares. For example, 14 = 9 + 4 + 1. In modern terms, we would state Lagrange’s theorem by saying that

w² + x² + y² + z²

is universal.

Here universal just means that given any natural number N we can find natural numbers w, x, y, and z which can be plugged into this formula and the resulting output is N. For example, since 14 = 3²+2²+1²+0², if we pick w=3, x=2, y=1, and z=0, then we are able to obtain 14. Being universal means we can do this for any number, not just 14.

People have been puzzling over these sorts of questions for thousands of years. Diophantus wrote an entire book on the subject [1]. No doubt mathematicians in China and elsewhere pondered similar questions. Number theorists have obsessed over solving such equations for millennia. A century ago Ramanujan asked if we could generalize Lagrange’s result by including coefficients. For example, is

w² + 2x² +5 y² +7 z²


2w² + 4x² + 6y² + 8z²

universal? If you think about it for a little bit, you will notice that in the second formula you can only get out even numbers. There is simply no way to get, say, 11 by plugging in natural numbers for w, x, y, and z.

On the other hand, Ramanujan proved that the first formula is universal! Even better, he managed to completely classify which coefficients you can choose and get a formula that is universal [2].

How the heck would you ever prove a formula is universal? That seems impossible on its face. By hand I checked that 14 = (0)² + 2(1)² +5 (1)² +7 (1)² and 23 = (1)² + 2(1)² +5 (2)² +7 (0)². But there are infinitely many numbers that have to be checked and every new number gives you a new equation to try and solve. You can’t possibly solve them all!

In 1993, John Conway taught a graduate course at Princeton on the topic of solving these sorts of equations. Based on recent work in the area, Conway thought it should be possible to show an equation is universal by just checking a limited (finite!) number of test cases. He and the students spent the class hour applying these methods and, with the help of some computer calculations, in a day or two had strong evidence that if you could use the formula to obtain 1, 2, …, 15, then you could get every other number!

This is absolutely astonishing to me. Take the equation w² + 2x² +5 y² +7 z². Show by hand that you can get the numbers 1 through 15 and, boom!, you know you can get 223,816,817,012 and every other natural number! This now-famous result is called the Fifteen Theorem [3]. With it in hand, you can easily check Ramanujan’s list (and discover that it has a small error!).

But we don’t have to stop with squares! Devoted readers of 3QD will recall an essay from 2015 where we talked about Gauss’s Eureka Theorem. He showed that every natural number can be written as the sum of three triangular numbers. What are triangular numbers? They are:

The first six triangular numbers. Borrowed from Wikipedia.

You can probably see the pattern. The kth triangular number Tk is the number of objects you need if you would like to arrange them in a triangle with three equal sides. In the Eureka Theorem Gauss proved that any natural number can be written using three triangular numbers. He was so excited about the result, he wrote EUREKA num[ber] = △ + △ + △ in his diary:


That is, Gauss showed that given any natural number you can always write it as

T+ T+ Tz

for three triangular numbers T, T, and Tz. For example, 14 = T+ T+ T4.

In light of Diophantus, Ramanujan, and the Fifteen Theorem, it is no surprise that people asked about triangular numbers with coefficients. Can you solve 14 = T+ 2T+ 5Tz? Even better, can we show

T+ 2T+ 5Tz

is universal?

Once again, solving this problem by brute force involves solving infinitely many different equations! Inconceivable [4]! In 2013, Wieb Bosma and Ben Kane proved that if you have a formula which is a sum of triangular numbers with coefficients (like T+ 2T+ 5Tz or Tw+ 3T+ 2T+ 5Tz), then you can check if it is universal just by checking 1, 2, 4, 5, and 8. If you can solve for these five numbers, you can solve for anything!

But we don’t have to stop with squares and triangular numbers. If you prefer pentagons, octagons, or icosikaitrigons, you can define the pentagonal, octagonal, or icosikaitrigonal numbers just as we did for the triangular numbers.  For example, the kth pentagonal number Pk is how many objects it takes to make a pentagon with five equal sides. The pentagonal numbers are:

1, 5, 12, 22, 35, 51, 70, 92,…

Fermat conjectured and Cauchy proved that if you use the numbers for an n-sided polygon, then you can write any number using a sum of n of them. So for the pentagonal numbers, you only need five of them to write any natural number.

Pentagonal numbers [5].
Of course, we aren’t satisfied. What if we use coefficients? And if we do use coefficients, how many numbers do we need to test to verify universality? Just last year Jangwan Ju and Daejun Kim proved that if you have a formula which is a sum of pentagonal numbers with coefficients (like P+ 2P+ 5Pz or Pw+ 3P+ 2P+ 5Pz), then it will be universal if and only if you can solve for:

1, 2, 3, 4, 6, 7, 8, 9, 11, 13, 14, 17, 18, 19, 23, 28, 31, 33, 34, 39, 42, and 63!

As you might guess, there is much we don’t know about counting with polygonal numbers. Thanks to Cauchy’s theorem from 1813 we know that you can always write any number as a sum of 23 icosikaitrigonal numbers. But can you do it with less? What if there are coefficients? Can you test for universality by only testing finitely many numbers? Which are the critical numbers you have to test? These are all wide open questions.

Pick your favorite polygon and start counting!




[0] Puppet created by Jim Henson, Count von Count, Sesame Street. 2013.0101.08. Image from the Smithsonian Museum.

[1] In honor of Diophantus’s obsession with equation solving, Metrodorus left us a puzzle for determining how long Diophantus lived:

‘Here lies Diophantus,’ the wonder behold.
Through art algebraic, the stone tells how old:
‘God gave him his boyhood one-sixth of his life,
One twelfth more as youth while whiskers grew rife;
And then yet one-seventh ere marriage begun;
In five years there came a bouncing new son.
Alas, the dear child of master and sage
After attaining half the measure of his father’s life chill fate took him. After consoling his fate by the science of numbers for four years, he ended his life.’

[2] Ramanujan gave the complete list. It turns out that there are 54 of them. See this article by Conway for the list and more about the Fifteen Theorem.

[3] In fact, the Fifteen Theorem proven by Conway and Schneeberger as an outcome of that graduate class is much wider than just Ramanujan’s original question. It covers all “integer-matrix positive-definite quadratic forms” of which Ramanujan’s equations are the ones that correspond to diagonal matrices.

[4] “You keep using that word. I do not think it means what you think it means.”

[5] Image borrowed from here.