Polygonal Numbers - or Numbers as Shapes

Numbers as an arrangement of dots can be made into various shapes such as triangle shapes, or squares, or pentagons, hexagons and so on. Such polygons are flat and two-dimensional but we can extend the idea to three and even to higher dimensions to get Figurate Numbers. They have been an object of interest for mathematicians since the days of Pythagoras and the Ancient Greeks and still provide an excellent vehicle for "proofs without words" and for spotting number patterns as well as for practicing proving your ideas using algebra.
The calculators and other effects on this page require JavaScript but you appear to have switched JavaScript off (it is disabled) in this browser.
Please go to the Preferences or Properties menu item for this browser and enable it and then Reload this page.
Contents of this page
The You Do The Maths... icon means there is a You Do The Maths... section of questions to start your own investigations.
The calculator calculator icon indicates that there is a live interactive calculator in that section.

Introduction to Number Dot Pictures

Mathematicians from the days of ancient Greeks have always been interested in the properties of numbers that can be arranged into regular shapes such as a triangle or a square. They are excellent examples to practice your mathematical skills of spotting patterns, writing the patterns as a formula and then proving the pattern is always true using algebra.
Some examples follow:

1 Dimensional patterns - Tally Sticks

One of the earliest uses of "written" numbers was almost certainly to count a number of objects such as sheep in your field. An early method was to put a notch in a stick or on bone, one for each object, then it was easy to check later that the same number of objects was there even without any words for the numbers.
If the stick has notches scratched across it, the stick could be split into half and two people have a copy in order to keep a record of debts or items owed.
They were used by the UK Exchequer for centuries and when the system of keeping records changed in 1826, the old wooden tally sticks were disposed of, except for some which were discovered later and accidentally burned down the Parliament building on 16 October 1834! This was a simple one-dimensional representation of numbers and may have led to the Roman Numerals. The problem of designing a shape for a number of dots when you can use 2 dimensions is much more interesting and we now turn our attention to shapes and then later look at the third - and higher - dimensions.

Number Shapes - in 2 dimensions

First, some examples of where numbers have been represented in a number shape, that is as a 2-dimensional flat shape. Then we look at the Polygonal Numbers that have fascinated mathematicians since the ancient Greeks and Pythagoras before we turn our attention to 3 dimensional solid shapes - and then the higher dimensions!

Examples of Number Shape Designs

The Flags of the USA

An excellent example of the problems of arranging a given number of dots into a pleasing shape is the American Flag. The decision was made early on that the each star in the "stars and stripes" should represent one of the States in the United States. This has changed often over time and the flag has been redesigned on many occasions. The first with this format was designed in 1777 and had just 13 stars to represent the 13 states, and then was extended to 15, 20, 21, 23, 24, ... up to the current 50 stars. The complete series is in A140646.

/ You Do The Maths...

  1. Suppose one new state was to be added to the United States, making 51. How would you redesign the stars to make a nice pattern?
  2. Use this little Calculator to produce a Random Number in some range that you can set (such as up to 20). Suppose the number generated is the number of states in a new country and you are given the job of designing a flag with one star (tree, dot, face, ...) for each of the states. What designs can you invent?
    C A L C U L A T O R
    random number up to
  3. Or instead of a USA flag, design a banner or flag for
    • your school Year with a star for the number of classes in your year (or choose some other symbol instead of a star) OR...
    • the number of people in your house with a face for each OR...
    • the number of teams in a local league
    Hold a competition and challenge your class or friends to see who can find the "best" design, decided by those submitting a design voting on the entries.

Playing Cards

French Playing cards in 1567 playing cards today
There have been several designs for the patterns on playing cards to indicate the numbers 1 to 10. Look at the pattern for 9 and for 7 on this French deck of 1587. The standard set of cards that you often see now (dating from about 1900) is also shown above and the images are available for you to use at Vectorized Playing Cards 1.3- http://code.google.com/p/vectorized-playing-cards/ (Copyright 2011 - Chris Aguilar Licensed under LGPL 3 - www.gnu.org/copyleft/lesser.html)

/ You Do The Maths...

  1. Design your own set of playing cards.
    1. How many suits will your deck of cards have?
    2. ? What will you call them?
    3. How many cards will you have in each suit?

The Polygonal Numbers

In this section we look at how to draw the Polygonal Numbers and some of the relationships between them.
The simplest shape for our Polygonal numbers is a triangle, then we proceed to the quadrilaterals: the square and rectangular numbers and so on.

The Triangle Numbers

We start with a triangle with a single dot,
then one with two dots on each side, giving a shape with 3 dots, then 3 dots on a side with a total of 6 dots, and so on.
The total number of dots in the shape with side (or rank) r is the rth Triangle Number.
The Triangle Numbers
shape tri tri tri tri tri tri
The list of Triangle Numbers is therefore:
1, 3, 6, 10, 15, 21,... which is A000217

Because Triangle numbers occur so often when we examine the polygon numbers of all shapes, we will often use the shorthand notation T(r) for the triangle number with r dots on each side, e.g. T(3) = 6
If we have a single line of cars waiting at traffic lights and any number of the cars may go through each time the lights are GO but the cars only go through in the original order. How many different sequences of cars are there that can go through the lights each time the lights are GO?
For instance, with 3 cars, ABC we can have: ABC; A, BC; AB, C; and A,B,C but we have already counted the single sequences with just A and just C, so the possible sequences are ABC; AB; BC; A; B; C making a total of 6 possible sequences of cars passing through through the lights. We can put this question in the following form also:

/ You Do The Maths...

    1. In a set of n consecutive numbers, how many subsets contain only consecutive numbers?
    2. Why is the answer T(n) for a set of size n?
    3. Why is this the same problem as the number of ways of inserting one pair of brackets in a sequence on n numbers? For example, for 3 numbers we have:
      (123), (12)3, 1(23), (1)23, 1(2)3, 12(3)

Everyday Examples of Triangle Numbers

10 pins
15 Snooker balls
15 pool balls
10 pin bowling
(click to buy these from ROMPA)
15 red Snooker balls Billiards or Pool
Click on the image to learn more
about the maths of Billiards


Let's look at some notation for our polygonal numbers.
Although T(r) is useful because the triangular numbers appear often when we are examining polygonal numbers, we also need a notation for all the shapes and sizes of polygonal numbers. The notation most often used is p for the Polygon numbers:
pn(r) means the polygonal number with n sides and the outer side (its rank) having r dots.
T(r) means the same as p3(r)

A Triangular Number Calculator

Here you can find triangular numbers between given limits or else give the ranks of the triangular numbers (the length of their sides).
We will use the common notation p3(r) to mean the rth polygonal number with 3 sides. r is called the rank of the triangular number meaning the length of (the number of dots in) the outside edges.
triangular numbers in the range from up to

calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

/ You Do The Maths...

  1. How many dots are there on an ordinary cubical dice? Why is this a triangular number?
  2. How many dominoes are there in a standard set? Why is this also a triangular number?
  3. If I have a product of n different variables: for example 3 variables a×b×c in how many ways can I insert one pair of brackets?
    E.g. for a b c we have (a)bc, (ab)c, (abc), a(b)c, a(bc), ab(c)
    3 variables have 6 correct single bracketted forms and the third Triangular number is 6.
    What about a b c d or a b?

The Square Numbers

If we have square shapes for our dotty diagrams, then they each contain a square number of dots as you might have imagined! Here they have been drawn with a corner at the top:
The Square Numbers
shape tri tri tri tri tri tri
So the list of Square Numbers is:
1, 4, 9, 16, 25, 36, ... which is A000290
A formula for this series is easy - the square with a side of r (its rank) has r2 dots.

Everyday Examples of Square Numbers

Square arrangements are around us everywhere, from flags on the pavement (sidewalk) to blocks of buildings in New York. But it is not so easy to find exact squares of dots. Here are some:
dice 4 domino 4:4 domino 9:9
Throw 4 with a die... ... or a double 4 in dominoes and some domino sets
go up to 9×9

A Square Number Calculator

square between and

calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

The Rectangular Numbers and the Primes

Rectangle numbers are those which can be represented as a rectangle a×b. Unless we want a single line of dots, then both sides are bigger than 1, but not all numbers are rectangle numbers. Those which are not are called prime numbers.
One of the major problems of mathematics - still unsolved - is to find an efficient way of testing if any number is prime or not: that is, checking if it has only two factors, 1 and itself. Any number that is not prime can we written as a product of two numbers (factors), often in several ways. A number not prime is called a composite number and the numbers that can be multiplied to make that number are called its factors or divisors. For instance 12 = 4 × 3 = 6 × 2 so 12 is composite and its factors are 1, 2, 3, 4, 6 and 12 itself.
All composite numbers are Rectangular Numbers
A Rectangular number can be written as a × b but we exclude the single line of dots and so both a and b must be bigger than 1.
12 = 3x4 = 3x4
Any non-Rectangular number is a Prime number
The Rectangular numbers including the Square numbers:
4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, ... A002808
These are just the composite numbers, the non-primes, having more than 2 divisors.
The Rectangular numbers excluding the Square Numbers:
6, 8, 10, 12, 14, 15, 16, 18, 20, 21, 22, ...
These are the numbers having an even number n of divisors, n>2.

The number of ways of writing n as a Rectangular number

The number of ways to express a number n as a product is the number of divisors of n.
6 has four divisors: 1, 2, 3 and 6 leading to two ways to write 6 as a Rectangular number: 1×6 and 2×3 but we exclude 1 and therefore 6 also as the sides of a Rectangular number. Thus we have

Highly composite numbers

4 is the smallest Rectangular number and is also square
4 = 2×2;
but 6 is the smallest purely rectangular number.
The first that is rectangular in two ways is
12 = 2×6 = 3×4,
the first that has three rectangular forms is
24 = 2×12 = 3×8 = 4×6;
the first with four rectangular shapes including a square is
36 = 2×18 = 3×12 = 4×9 = 6×6
and the first purely rectangular number with four rectangles is
48 = 2×24 = 3×16 = 4×12 = 6 ×8
the next numbers to break records are:
60 with five rectangular forms
120 has seven forms
180 has eight
360 has twelve
720 has fourteen
840 has fifteen and
1260 has seventeen.
The series above is part of the series of highly composite numbers, where each has more factors than any smaller number: 2, 4, 6, 12, 24, 36, 48, 60, 120, ... A002182.
The smallest purely rectangular numbers (excluding the square numbers) with a given number of rectangles are:
4, 6, 12, 24, 48, 60, 120, 180, 240, 360, ....
and if we include the squares the records are achieved by:
6, 12, 24, 36, 60, 120, 180, 240, 360, ....
I suspect that both series are identical except for the extra 4 beginning the former and 36 being replaced by 48.

The Oblong Numbers

Another special sub-group of Rectangle numbers, apart from Square numbers, are the Oblong numbers.
These are Rectangular with the longer side exactly 1 more than the shorter side, that is of the form n (n+1).
If we put two copies of a triangle number together, we get a rectangle of size n (n+1):
This simple series has many applications in its own right.
2, 6, 12, 20, 30, 42, ... A002378

Other names for the Oblong numbers are the pronic (or promic) numbers but we will use Oblong on this page.

A Calculator for Square, Rectangular, Oblong and Prime Numbers


between and


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

/ You Do The Maths...

  1. When is twice an oblong number oblong? (Check: A098602)
  2. Make a list of those Rectangular numbers which have just a single Rectangular shape. The list starts with 6, 8, 10. How many can you find less than 100?
    6, 8, 10, 14, 15, 16, 21, 22, 26, 27, 33, 34, 35, 38, 39, 46, 51, 55, 57, 58, 62, 65, 69, 74, 77, 81, 82, 85, 86, 87, 91, 93, 94, 95 = 34 numbers
  3. What about those with two distinct rectangles, for example 12?
  4. Can you find a method of calculating how many rectangular forms there are for a given number if we exclude the square numbers? It will help if you first factor the number into its prime factors and their powers, for example:
    12 = 22 × 31 and it has 2 shapes of rectangle as do
    18 = 21 × 32 and
    20 = 22 × 51 and
    63 = 32 × 71 whereas
    24 = 23 × 31 has 3 different shapes and so does
    30 = 21 × 31 × 51 but
    72 = 23 × 32 has 5.
  5. What is the sum of the reciprocals of the first n oblong numbers?
    1 = ?
    1 + 1 = ?
    1 + 1 + 1 = ?
    What is the sum of the reciprocals of all of them?
    The sum of the reciprocals of the first n oblong numbers is n/n+1
    In the limit, as n→∞, the sum of all the reciprocals is 1.
  6. How many ways can I place one square and one domino in a strip of n squares?
    For n=4, if the strip has squares numbered 1,2,3 and 4 and [x] indicates the square and [x y] the domino, then we have:
    [1 2][3] 4, [1 2] 3 [4], [1][2 3] 4, 1 [2 3][4], [1] 2 [3 4], 1 [2][3 4] : 6 ways.
    What if the strip was of length n=5? n=6? n=7?
    Can you justify your answer?
  7. What is the average of two consecutive oblong numbers?
    The average of n(n-1) and n(n+1) is n2
  8. Generalize this pattern of 4 oblong numbers:
    4 oblongn + 1
    = 4 n(n+1) + 1
    = 4n2 + 4n + 1
    = (2n+1)2
  9. [Harder: suitable for a Maths Project]
    When is the product of two oblong numbers oblong?
    Simple examples are two neighbouring oblong numbers (why?), but there are others such as
    (1×2) × (14×15) = 20×21
    Can you identify all of them?
    • When is the Product of Two Oblong Numbers Another Oblong? Trygve Breiteig Mathematics Magazine Vol. 73, No. 2 (Apr., 2000), pp. 120-129
  10. [Harder: suitable for a Maths Project]
    When is the sum of two oblong numbers oblong?
    Simple examples are
    (3r)(3r+1) + (4r+1)(4r+2) = (5r+1)(5r+2)
    (3r)(3r–1) + (4r–1)(4r–2) = (5r-2)(5r-1)

    (6×7) + (20×21) = 462 = 21×22
    Can you identify all of them?

Everyday examples of Rectangular Numbers

6 eggs in a box

Trapezoidal Numbers or Runsums

If we sum a succession of whole numbers, we have the sum-of-a-run or a runsum.
E.g. 4 + 5 + 6 = 15
These are just the difference of two triangular numbers since we have, in our example,
1 + 2 + 3 + 4 + 5 + 6 – (1 + 2 + 3) = T(6) – T(3) = 21 – 6 = 15 but they can be arranged into a trapezium shape (a quadrilateral with two opposite sides parallel and two opposite sides not parallel):
There is much more about these on Introductory page and this follow-on page at this site.

The Pentagonal Numbers

We can continue with polygons of 5 and more sides. We will keep the pattern of having a "nest" of polygons, all of the same shape, each one containing the smaller ones inside it, with 2 sides in common with its next smaller neighbour. They all start from a common corner.
shape tri tri tri tri tri tri

1, 5, 12, 22, 35, 51, ... which is A000326

The Hexagonal Numbers

Here are the 6-sided hexagonal numbers
shape tri tri tri tri tri tri

1, 6, 15, 28, 45, 66, ... A000384

Heptagonal, Octagonal, etc Numbers

The 7-sided polygonal numbers are called Heptagonal:
1, 7, 18, 34, 55, 81, ... A000566
and the 8-sided octagonal numbers are:
1, 8, 21, 40, 65, 96, ... A000567
and so on. In the next section we will find a general formula for the polygonal number with n sides and r dots on the outside edges. Can you find the hexagonal numbers in this number pattern?
62 + 72 =  92 + 22
152 + 162 + 172  =  192 + 202 + 32
282 + 292 + 302 + 312  =  332 + 342 + 342 + 42

Algebra and Polygonal Number Patterns

The number patterns are already proofs without words but it is not only good practice for algebra (if you are at school) but also a simple method of proof of the patterns we find in the polygonal numbers. We see how the shapes interact with the algebra in this section.

A Formula for the Polygon number with N sides and rank R

Hypsicles in about 175 BC in Greece gives a nice definition of Polygonal Numbers :
If there are as many numbers as we please beginning with 1 and increasing by the same common difference,
then when the common difference is 1 the sum of all the terms is a triangular number;
when 2, a square;
when 3 a pentagonal number.
And the number of the angles is called after the number exceeding the common difference by 2,
and the side after the number of terms including 1
By this he means that we take an arithmetic series, starting at 1, and increasing by the same common difference:
so a difference of 1 gives the series 1, 2, 3, 4, 5, 6,...
and summing these from the beginning gives the series
1, 1+2=3, 1+2+3=6, 1+2+3+4=10, which are the Triangular numbers.
if the difference is 2, starting at 1 we have the series 1, 3, 5, 7, 9, ...
and summing these gives the series
1, 1+3=4, 1+3+5=9, 1+3+5+7=16, ... the square numbers
and so on for differences 3, 4, 5, ...

Finding Formulae for Number Pattern Diagrams

Here you can have a go at finding the formulae for yourself and then press the buttons to reveal some hints and answers.

A formula for the Triangular Numbers

Can you find a formula for the Triangle numbers p3(r)?
The Triangle Numbers
shape tri tri tri tri tri tri
The list of Triangle Numbers is therefore:
1, 3, 6, 10, 15, 21,... which is A000217

Here are a couple of ways to derive a formula.
We can use a recursive definition:
The triangle with side r is just the triangle with side r –1 with an extra row of r dots:
p3(r) = p3(r–1) + r
We start with p3(1) = 1, so we can use the recursive formula to find p3(r) for any r now.
We can find a formula :
If we take two copies of the rth triangle of dots, and put them together like this:
Each Triangle is paired with an identical one upside-down to make a rectangle.
The height of the rectangle is the size (rank) of the Triangle and its width is one longer.
So the two p3(3) triangles of size 6 make a rectangle of 6 + 6 = 3 × 4 and
the two p3(4) triangles of size 10 make a rectangle of 10 + 10 = 4 × 5
and so on.
We can do this with any p3(r) to get a rectangle of r (r+1) dots.
Since this is made up of two copies of p3(r), then we have our formula:
p3(r) = r( r+1 )

Two Consecutive Triangles make a Square

Check your Triangle formula by showing that two consecutive Triangle numbers make a Square.
First let's check the numbers in the diagrams above:
p4(3) = 32 = 9 = 3 + 6 = p3(2) + p3(3)
p4(4) = 42 = 16 = 6 + 10 = p3(3) + p3(4)
p4(5) = 52 = 25 = 10 + 15 = p3(4) + p3(5)
So the general formula we want to prove is:
p4(r) = r2= p3(r–1) + p3(r)
The formulae we already know are:
p3(r) = r(r+1)/2, p4(r) = r2
We put these into the formula we want to prove and show both sides are equal.
First the left-hand side:
p4(r) = r2
and the right-hand side:
p3(r-1) + p3(r) = (r–1)r/2 + r(r+1)/2
= ( (r2 – r) + (r2 + r) )/2
= 2 r2 / 2
= r2
The Greek mathematician Nicomachus proved this in 100 AD.

A Formula for the Pentagonal Numbers

Can you find a formula for the pentagonal numbers?
side r123456
diagram tri tri tri tri tri tri
size p5(r)1512223551

Here we use the fact that each polygonal number can be divided up into identical triangles and we now know the formula for triangle numbers. We take off one side from a Pentagon of rank r, then the rest of the sides are used to make triangles of sides r-1. Here are the Pentagons above drawn with in this manner:
In each of these patterns we have or, since a triangle with r–1 dots per side has (r–1)r/2 dots:
p5(r) = r + 3 (r–1)r/2
Simplifying this we have:
p5(r) = (3 r – 1 ) r/2
So all Pentagonal numbers of rank 3 or more are Rectangle numbers.

A Formula for the Hexagonal Numbers

The hexagonal numbers can be conveniently squashed into a nice rectangle which makes finding a formula for them particularly easy:
shape tri tri tri tri tri tri
rectangle tri tri tri tri tri tri
A rank r hexagon as a rectangle has height r and width equal to the r-th odd number 2r – 1 and so we have:
p6(r) = r ( 2r – 1)

Let's now look at the general case and find a general formula.

Calculating the Polygonal Number of shape N and size R

There are several ways of calculating any polygonal number, some quicker than others. We will first look at using earlier results for smaller values to find the next polygonal number. These are often the easiest was to calculate answers to many problems. Then we will look in more detail at one method by which we can find a direct formula for any polygonal number.

From one to the next - recursive definitions

For many mathematical problems, the easiest way into finding a solution is often to see how we can use a solution to a smaller problem to solve a larger one. Here is a table of some of the smaller values of pn(r):
The Polygonal Numbers pn(r)
nr 123 4 5 6 7
2 1 2 3 4 5 6 7
3 1 3 6 10 15 21 28
4 1 4 9 16 25 36 49
5 1 5 12 22 35 51 70
6 1 6 15 28 45 66 91
7 1 7 18 34 55 81 112
In terms of the COLUMNS, each is a simple Arithmetic progression - the common difference between successive entries in any one row is a constant. For r=2 the difference is 2, for r=3 it is 3 and for rank r the items always differ by r. So pn(r) = pn-1(r) + r and p2(r) = r.
From here it is quite easy to find a formula for pn(r).

For the ROWS, there is another recursive relationship.
For example, when n=3 we have the triangular numbers, the differences between them are

3-1=2, 6-3=3, 10-6=4, 15-10=5, ...
To get the r-th triangular number we add r to the previous triangular number (of rank r-1):
p3(r) = p3(r-1) + r and p3(1) = 1

But when n=4, the square numbers, the differences are

4-1=3, 9-4=5, 16-9=7, 9, ..., which are just the odd numbers.
The r-th square number is in fact (2r-1) more than the previous one:
p4(r) = p4(r-1) + 2r – 1 and p4(1) = 1
But this is just our old friend from algebra:
r2 = (r-1)2 + 2r-1

We can do the same thing for the pentagonal numbers, but the differences this time are

4, 7, 10, 13, 16, ...
for which a formula is 3r+1 or 3r-2. With a little testing we find:
p5(r) = p5(r-1) + 3r – 2 and p5(1) = 1

We can continue with the other rows by spotting a pattern in these differences.

This is an effective method for computing pn(r). It will find the value for any n and any r, eventually! However, it takes quite a lot of work if we have a large value for n or r since, in effect, we need to know all the values before it on any row or column - unless we can find a formula which depends only on n and r and not on previous values.

A formula for pn(r)

A direct formula means we plug in the values of n and r and can directly compute pn(r) using simple operations such as +, –, ×, / and powers. When we can find such a formula it is often the fastest way to compute a value, but for some problems, all we know is a recursive definition. However, in the case of pn(r), there is a simple formula and it is simple to prove too.
Can you now find a formula for a general polygonal number pn(r)?
A hint for one method is in the colourings of these rank 6 polygons:
The idea of dividing each figure into triangles, as we did for the Pentagonal numbers proof, will work for any polygonal number, as we see in the diagrams above.
pn(r) consists of
pn(r) = r + ( n–2 ) ( r–1 ) r

Here is a table and another way of deriving alternative forms for pn(r) by generalizing patterns across the rows or down the columns:
The Polygonal Numbers pn(r)
2 1 2 3 4 5 6 7½ r(0r+2)=rA000027
3 1 3 6 10 15 21 28½ r(1r+1)A000217
4 1 4 9 16 25 36 49½ r(2r-0)=r2A000290
5 1 5 12 22 35 51 70½ r(3r-1)A000326
6 1 6 15 28 45 66 91½ r(4r-2)=r(2r-1)A000384
7 1 7 18 34 55 81 112½ r(5r-3)A000566
n1½ 2n
½ 3(2n-2)
½ 4(3n-4)
½ 5(4n-6)
½ 6(5n-8)
½ 7(6n-10)
½ r( (n-2)r - (n-4) )
= ½ r( (r-1)n - (2r-4) )
OEISA000027A008585 A016957A017329 A139606A139607
The Polygonal Numbers pn(r)

We now have these formulae for the Polygonal number pn(r) of n sides and size r (that is the number of dots on each of the n outer sides):

pn(r) =
r (n – 2 ) r – n + 4
r (r – 1) n – 2r + 4
nr (r – 1) – r (r – 2)
r + (n – 2) r (r – 1)
r (r + 1)+ (n – 3)r (r – 1)
(n – 2) r2 – (n – 4) r
We will refer to these equations later using the names (A) to (F). Some simple algebra will show that they are all the same formula.

There are some recursive formulas too:

pn(r) = pn–1(r) + r(r – 1)/2   if n>2 (R1)
p2(r) = r
pn(r) = 2 pn(r – 1) – pn(r – 2) + n – 2   if r>1, (R2)
pn(0) = 0
pn(1) = 1

A Calculator for Polygonal Numbers

This Calculator will find numbers in a given polygonal series that in a given range.
The other Calculator below will find much more, including numbers common to several polygonal series, which shapes of polygon a given number has and ways of representing numbers as sums of polygonal numbers.
-gonal between and


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

Proofs Without Words

The patterns we have seen above are just "Proofs without words". They demonstrate a mathematical property true for an infinite collection of shapes. They can also be verified quite easily using algebra and applying just the formula for pn(r). Here you will find various pictures showing patterns in the polygonal numbers using colours. Your job is to express the pattern using the language of mathematics and then, using algebra and formulae of the previous section, to provide a proof that your formula will always be correct.
For each pattern, write the general pattern using mathematics and show that the components in different colours sum to the number of dots in the whole polygon.
Complete Graphs
If we draw n points round a circle and join them with straight lines in all possible ways, how many lines are there?
Such diagrams are called Complete Graphs or Complete Networks and are denoted Kn.
← Show a diagram of all lines connecting points
From one triangle number to the next
line + Tri 3 line + Tri 3 line + Tri 3 line + Tri 3 line + Tri 3
  2 + T(1) = T(2) 3 + T(2) = T(3) 4 + T(3) = T(4) 5 + T(4) = T(5)
Here is an example answer:
n + T(n-1) = T(n)
Using the basic formula for T(n):
T(n) = ½ n(n+1)
we have: T(n-1) = ½ (n-1) n
The left-hand side of our formula, with T(n-1) from above, becomes: n + T(n-1) = n + ½ (n-1) n
n + T(n-1) = ½ (2n + (n-1) n )
n + T(n-1) = ½ (2n + n2 - n )
n + T(n-1) = ½ (n2 + n )
n + T(n-1) = ½ n ( n+1 ) but this is the formula for T(n)
n + T(n-1) = T(n) so our proof is complete
3 Triangles plus the previous one
3 Triangles plus the next one
1 line + Sqr 3
From one square to the next
1 line + Sqr 3 line + Sqr 3 line + Sqr 3 line + Sqr 3
1 + 01 = 12 3 + 12 = 22 5 + 22 = 32 7 + 32 = 42 9 + 42 = 52
Summing the whole numbers up and down
Summing up the odd numbers
1 1+3 1+3+5 1+3+5+7 1+3+5+7+9 1+3+5+7+9+11
Two triangles plus a line
line+2tri=sq line+2tri=sq line+2tri=sq line+2tri=sq line+2tri=sq line+2tri=sq
12 + 2×1 = 43 + 2×3 = 9 4 + 2×6 = 165 + 2×10 = 256 + 2×15 = 36
8 Triangles plus a dot
line + Sqr 3 line + Sqr 3 line + Sqr 3 line + Sqr 3 line + Sqr 3
1 + 8 T(1) = 32 1 + 8 T(2) = 52 1 + 8 T(3) = 72 1 + 8 T(4) = 92 1 + 8 T(5) = 112
A Square with a triangle on one side
sq+tri=pent sq+tri=pent sq+tri=pent sq+tri=pent sq+tri=pent sq+tri=pent
Summing the n numbers starting from n
sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex
A square with two triangles on its sides
1 sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex
14 + 2×1 = 69 + 2×3 = 15 16 + 2×6 = 2825 + 2×10 = 4536 + 2×15 = 66

/ You Do The Maths...

  1. Choose one of the Complete Network diagrams above.
    To make it into a piece of art for your wall or shelf you can draw it on a piece of stiff paper such as black paper and use a silver-based gel pen for the lines.
    k19 But how about making it from wood, nails and a reel of cotton as follows:
    • On a piece of solid wood, which you might like to paint black to begin with, draw a circle and mark out the number of equally-spaced points on its circumference for the diagram you have chosen.
    • Carefully knock a nail into each point.
    • Wrap white cotton, string or wire round the nails to join each nail to every other nail to make your own copy of the diagram.
    • What diagrams do you get if the n points are equally placed around the outside of a square and each point is joined to all the others?
  2. Is it possible to draw the complete diagram Kn without taking your pen off the paper or by never cutting the cotton wrapped round the nails in the exercise above if you never go over any line twice?
    Hint: Consider the simple cases such as K3 - is it possible?
    What about K4? and K5?

    K3, a simple triangle, is possible;
    K4, a square with both diagonals, is impossible
    After that, all complete networks on an odd number of points are impossible and all with an even number of points are possible.
  3. Euler proved a very simple theorem to test any network of points and lines joining them to see if it could be drawn without taking the pen off the paper. Such a continuous line is call an Eulerian circuit if the single line you draw starts and ends at the same point or else it is an Eulerian path if all the lines are drawn but you end up at a different point to the one you started from.
    1. What is Euler's Theorem? (It is surprisingly simple!)
      Count the number of lines that meet at each point. If they are all even, then it is possible to find a continuous path using all the lines once only, starting at ending at the same point.
      If there are just 2 points with an odd number of lines meeting at them, then a path is possible starting at one and ending at the other.
      In all other cases it is impossible to find a continuous path using every edge just once.
    2. How can you apply it to the Kn networks and decide if we can or cannot draw it without taking the pen off the paper?
      In Kn, all points are joined to all others so each of the n points has n-1 lines meeting at it.
      So, if n is odd, all the points have an even number of lines meeting and so a single path through all is possible.
      If n is even, then each point has an odd number of lines meeting there and so since n is even and 2, all Kn for even n are impossible.
  4. Curve Stitching
    From a point P on the page draw two lines at any angle to points Q and R.
    Mark a number n of equally spaced points on each line PQ and PR, the same number on each.
    Knock a pin or nail into each of the n points on the two lines.
    Using thread and ignoring the point P, join the outermost point on one line to innermost point on the other and repeat with the remaining points.

    Originally, these were made using a needle and thread to stitch the lines through holes in the card or else using string or a gold or silver coloured wire wrapped round nails on wood. The straight lines produced a curve as an envelope of the stitched lines, hence curve stitching.

    In the diagram here n=7 with the two original lines in black and the string shown in red.

    1. How many points are there where the string crosses itself, excluding at the pins.
      Note that nowhere do we have three or more string lines crossing.
    2. If we look at all the lines in the diagram, the original two and the ones made by the string, how many points are there where two or more lines meet?
    3. Now count the regions made by the string. How many are there between your two lines?

  5. Show a triangle of layers
    Here is a well-known puzzle that appears often in puzzles and competitions.
    How many triangles are there in this diagram (of 4 layers of Δ triangles)?
    You should be able to answer it now that you know all about Triangle numbers.
    The answer is complicated by there being are both Δ triangles and "upside-down" triangles ∇ and each being present in a variety of sizes. But by counting all the sizes of Δ triangles and then separately considering the ∇ ones you should be able to solve the puzzle for small values of n.
    Suppose there are n layers of Δ triangles.
    There are T(n) basic (size 1) Δ triangles.
    If we group 4 Δ triangles together to make a Δ-triangle of 2 layers, by considering the top-most triangle of each, we see there are T(n–1) of these within the whole diagram.
    We can repeat this with sub-triangles that are 3, 4, ... and up to n layers.
    There is just one triangle of n layers.
    Adding up all these we get:
    T(n)+T(n–1)+...+T(2)+T(1) = n (n + 1) (n + 2)
    This gives a total of 4 for the 2-layer triangle, 10 for the 3-layer and 20 for the 4-layer, etc.

    As to "upside-down" ∇ triangles, there are T(n–1) single triangles.
    However, if n≥4 there are T(n–3) ∇ triangles made from 4 single ∇ triangles - because we cannot use the top two layers in the diagram nor the lowest layer to be the top of a 2-layer ∇ triangle.
    We must have at least 2n layers for there to be a ∇-triangle of n layers. The diagram of 6 layers is the first to have a 3-layer ∇-triangle and then it has only the one.
    The total number of ∇ triangles of all sizes in an n-layer Δ triangle is:
    2:1, 3:3, 4:6+1=7, 5:10+3=13, 6:15+6+1=22

    The total number of Δ and ∇ triangles of all sizes in a Δ triangle diagram of n layers is:
    n123456 ...
    Total1513274878... A002717

Two Triangles make another

Let's use the shorthand notation T(r) for the rth Triangle number: T(r) = p3(r) = r(r+1)/2

/ You Do The Maths...

  1. If we take two copies of T(2) = 3, we have 6 dots which we can make into a single Triangle number because 6 = T(3).
    Can you find any more Triangle numbers that, when doubled, make another Triangle number?
    See A075528 for answers.
  2. 10 + 45 = 55 is also T(4) + T(9) = T(10)
    1. Which are the Triangle numbers that can be added to one triangle number to give the next triangle number?
    2. We can add 5 to T(1)=1 and to T(4)=10 to get the triangle numbers T(3)=6 and T(5)=15 but 5 is not a triangle number. Can you find a triangle number that can be added to two triangle numbers to get two more?
    3. Find a triangle number which you can add to at least 3 other triangle numbers and each time the total is a Triangle number.
    4. Can you find one number that is not the difference between two triangle numbers?
  3. One of the number patterns above showed us that if we add two consecutive Triangle numbers we will always get a square, For example
    T(2) + T(3) = 3 + 6 = 9 = 32
    This investigation asks you to find pairs of Triangle numbers that are not consecutive and yet whose sum is a square.
    For example,
    T(2) + T(12) = 3 + 78 = 81 = 92
    T(2) + T(22) = 3 + 253 = 256 =162
    1. Find some more Triangle numbers which are square when T(2) = 3 is added to them. Can you find a formula or other patterns in these numbers?
    2. Try the same thing but using another Triangular number in place of T(2) = 3.
    3. Is it always true that there are an infinite number of Triangle numbers that, when added to a given Triangle number result in a sum that is square?
    4. Can you find dot diagrams for any of your results?
  4. Find two different triangular numbers that add together to make another triangular number.
    Do you think it is true that for every triangular number there is always another which can be added to it to make a third?
    If so, write down a formula for your pattern and use the T(n)=n(n+1)/2 formula to prove it is true.
  5. Instead of adding two triangle numbers, this investigation is about multiplying two different Triangle numbers to make a square.
    For instance, T(2) × T(24) = 2×3 ×24×25 = 3×12×25 = 302
    1. Are there more Triangle numbers that when multiplied by T(2) = 3 are square?
    2. What if you used another Triangle number instead of T(2) = 3?
    3. What patterns and formulae can you find?

  6. T(1) + T(2) + T(3)  =  T(4)
    T(5) + T(6) + T(7) + T(8)  =  T(9) + T(10)
    1. How does the pattern continue?
    2. Can you find a formula for the left-hand sides and for the right-hand sides and prove they are equal?
  7. This problem is quite hard!
    Find pairs of Triangular numbers whose difference and whose sum are also triangular numbers,
    e.g. T(5) = 15 and T(6) = 21.
    Their difference is T(6) - T(5) = 21 - 15 = 6 = T(2)
    and their sum is T(6) + T(5) = 21 + 15 = 36 = T(7)

    Such pairs are not too common, but the next pair are both less than 1000.

    This problem was posed by J Ozanam in 1696 and he found 3 pairs. The third pair of numbers are each 7 digits long and this is a long time before mechanical or electronic calculators were invented!

A Triangle Number that is also a Square

Can you arrange the four pieces of the triangle on the left to make a square?
Here is a nice animation of the transformation:

Can we find any Triangle Numbers that are also Square numbers?

/ You Do The Maths...

  1. Apart from the number 1, find some more numbers that can be arranged into a triangular shape and also into a square. Hint, there is another less than 50:
    1, 36, 1225, 41616, ... A001110
  2. What are the triangle ranks of these numbers? Is there a pattern?
    1, 8, 49, 288, 1681,... A001108
    You may have noticed that the n-th triangular rank is 6×(n-1)th – (n-2)th + 2.
  3. What are the sizes (ranks) of the squares?
    Can you find a simple recurrence relation to fit this series?
    1, 6, 35, 204, 1189, ... A001109
    The n-th square rank is 6×(n-1)th – (n-2)th.
  4. Sometime the sum of the first n numbers is a square number m2. For instance,
    1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36 = 62
    How are the solutions for m related to the triangular square numbers?
    How are the solutions for n related to the triangular square numbers?
    If the sum of the first n numbers is m2 then both these quantities are triangle numbers that are square.
    The values of n are the triangular ranks and the values of m are the square ranks.
There is a formula for the triangular square numbers, but the recurrence relations given in the above You Do The Maths... are easier
(17 + 12 √2)n + ( 17 – 12 √2)n – 2
It looks as if this formula shouldn't give whole number solutions, but it does!

Two Squares make another

The problem of finding two squares whose sum is another square is a famous problem since Pythagoran Pythagoras' Theorem says:
If the sides of a right-angled triangle are a, b and the longest side (the hypotenuse) has length h then a2 + b2 = h2
There is much more on this problem on my Pythagorean Triangles and Triples page on this site, so we will leave the reader to investigate this problem separately. Meanwhile, how about.....

A Square number that is also Pentagonal

a jigsaw which makes a square and a pentagon Here is a nice jigsaw which can either make a square or else a pentagon. (Click on the image to buy this puzzle).

But if we use dots and pentagon numbers, can you find a square number which can be rearranged to make a pentagon too? .. and we exclude 1 as it is always the "first" Polygon number no matter what shape we have!

[HINT: You will have to search Pentagonal numbers up to 10,000 to find the first!]

9801 = p4(99) = p5(81)
There are more... the next being 94109401. The series continues: A036353

What about other combinations such as Triangular numbers that are also Pentagonal? Here is a page of other jigsaw dissections for polygons. Do they also have equivalents in Polygonal Numbers?

When is a number Polygonal?

All numbers k are polygonal in a simple way: as a polygon with 2 dots on each of its k sides, that is, of rank 2, because:
k = pk(2) for all numbers k>0
But what about numbers which are polygonal of rank greater than 2? But what about other shapes?
Can we find a method for deciding if a given number is, for example, a triangle number or a pentagonal number? Given a number, is there a method we can use to find all its shapes and sizes?

How to find all the ways a given number is Polygonal

The collection of Polygonal numbers of rank r>2 begins as follows:
Polygonal Numbers k of rank>2
k6 9 10 12 15 16 18 ... A090466
shapetri2 sq3 tri3 pent3 tri5
sq4 hept3 ...
So not all numbers are Polygonal if we consider only those with rank r>2.
If we include rank 2 also, then every number n is polygonal in at least one way (a polygon of n sides whose rank is 2). If we count the number of polygonals for 3,4,5,... we have the series
Counts111211221211321211... A177025
When is k a Polygonal number?
Given a value of k, how can we find n and r for which k = pn(r)?
The Greek mathematicians from Pythagoras and onwards, including Diophantus, (approx 200 AD to 284 AD) started to explore this problem but did not find a method. They were using only geometry but we will use algebra together with the formulae above for pn(r) to find a solution. Our method is essentially that of G Wertheim of 1897 (see the reference below, volume II, Diophantine Analysis, page 3).
From formula (B) above we have:
Given the value of k, to find n and r such that k = pn(r) using the formula (B)
2 pn(r) = r ( (r–1)n – 2r + 4 )
So our first step is to double the given number k and find its factors, because from this formula, one of them is r. We only want factors 2 k = a × b and r is the smaller of the two factors so, since the minimum rank for a polygonal bigger than 1 is 2, the smallest factor must be 2 or more.
First make a list of each pair of factors of 2 k = a×b where a ≤ b:
Take for example, k = 28.
2 k = 56
= 2 × 28
= 4 × 14
= 7 × 8
For each of these, take r as the first and then we have the value of the second factor in our formula, namely (r–1) n – 2r + 4. Substitute the value of r:
2 k = 56
= 2 × 28
Let r=2, then 28 = (2-1)n - 4 + 4 = n which means n must be 28 and k=p28(2): correct!
= 4 × 14 Let r=4, then 14 = (4-1)n - 8 + 4 = 3n-4 which means n must be 6 and k=p6(4): correct!
= 7 × 8 Let r=7 then 8 = (7-1)n - 14 + 4 = 6n-10 which means n must be 3 and k=p3(7): correct!
28 is polygonal in three ways



NOTE that sometimes a factorisation of 2k produces a value of n that is not an integer, for example when k=12:
2 × 12 = 4 × 6 Let r=4 then 6 = (4-1)n - 8 + 4 = 3n-4 and so n= 10/3
We reject those cases but the great mathematician Euler did look into Polygonal numbers of fractional size!

/ You Do The Maths...

  1. There are two more numbers smaller than 28 that can also have 3 polygonal shapes. What are they?
  2. What is the only number less than 40 that has 4 polygonal shapes?

How to check if a given number has a particular polygonal shape

We could just use the method in the previous section to find all the ways that a given number is polygonal then check to see if a particular shape was in that list. But if you want to see if a number is of a particular shape, there is a test that does not involve factoring numbers. It is left as an exercise for the reader to use one of the pn(r) formulae above and rearrange it to find r given n and the number pn(r).
pn(r) = r( (n–2)r – n + 4 )
we are given p (let's use this to stand for pn(r)) and the shape of the polygon n and we want to find r if the number p is indeed in the series of n-gonal numbers.
2 p = (n – 2) r2r (n – 4 )    ⇒
(n – 2) r2r (n – 4 ) – 2 p = 0
and we have a quadratic in r which we can solve to get:
r =(n - 4) ± (n - 4)2 + 8 p ( n – 2)
2 ( n – 2)
The part under the square-root is bigger than (n - 4)2 so taking the – sign before it would make r negative.
So we have this formula for the value of r that we sought:
r =(n - 4) + √(n - 4)2 + 8 p ( n – 2)
2 ( n – 2)
It will only give a whole number if: If any of these conditions fail, then our given value of p is not an n-gonal number.

The Multi-Polygonal Number Calculator

C A L C U L A T O R :   P o l y g o n a l   N u m b e r s
Numbers common to several shapes

simultaneously: -shaped in the range

up to

Numbers with many shapes
numbers having shapes; number search range:
show shapes?
Which polygonal shapes?

all Polygonal numbers in the range
exclude rank 2?


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred
Using the calculator above we can find that:
The number of shapes for n (including rank 2), starting at 2 is
1, 2, 2, 2, 3, 2, 2, 3, 3, 2, 3, 2, 2, 4, ... A129654
Those numbers having a given number of shapes (including rank 2):
The smallest number that is polygonal in 1 way is 3 = p3(2)
The series of such numbers with just 1 shape is 3,4,5,7,8,11,13,14,17, ... A090467
The smallest number that is polygonal in 2 ways is 6 = p6(2) = p3(3)
The series is 6,9,10,12,16,18,22,24,25,27,30,... A117029
The smallest that is polygonal in 3 ways is 15=p15(2)=p6(3)=p3(5)
The series of such numbers is 15,21,28,51,55,64,70,75, ...A195527
and in 4 ways the smallest is 36=p36(2)=p13(3)=p4(6)=p3(8)
36,45,66,81,105,120,153, ...A195528
The smallest numbers polygonal in n ways for n=1,2,... are 3, 6, 15, 36, 225, 561, 1225, 11935, 11781, 27405, ... A063778
Not all pairs of polygonal shapes have common numbers. For instance, no numbers exist that are both triangular and 11-gonal. Such impossible pairs are detected in the Calculator above. Then, if not impossible, the Calculator searches for numbers common to all the given shapes.

See if you can spot the rule for impossible-pairs. Here is a list of all the smaller pairs of polygon shapes that have no numbers in common:

3 and any of: 11, 18, 27, 38, 51, 66, 83. ...
4 and any of : 10, 20, 34, 52, 74, 100, ...
5 and any of: 14, 29, 50, 77, ...
6 and any of: 11, 18, 27, 38, 51, 66, 83, ...
7 and any of: 22, 47, 82, ...
8 and any of: 26, 56, 98, ...
9 and any of: 30, 65, ...
10 and any of: 20, 34, 52, 74, 100, ...
Check your answer here:

Is every number the sum of Polygonal Numbers of one shape?

We have already seen that all numbers are the sum of at most 3 triangular numbers, proved by Gauss when a young man.
So what about square numbers?

Sums of Triangular Numbers

As we go further down the list of triangular numbers, we know their differences increase by one each time, which makes for an easy way to compute the Triangular Number series from the beginning:
1 + 2 = 3
3 + 3 = 6
6 + 4 = 10
10 + 5 = 15
This was how the ancient Greeks defined this sequence.
We saw above that we can add two neighbouring Triangular numbers to make a square.
What other numbers are possible if we add Triangular numbers?
The fascinating answer is "They all are!" and that we need no more than 3 triangular numbers to add to make any number we like!
This had been suspected for a while but it was Gauss (1777-1855) who famously wrote in his diary on 10 July 1796:
ΕΥΡΗΚΑ! num = Δ + Δ + Δ!
or, as we might say, "EUREKA! (I've found it!) Every number is the sum of 3 triangular numbers". He had found the first proof.
Of course some numbers are triangular already,
and we know the squares are the sum of two triangular numbers
but Gauss's proof is that we never need more than 3 of triangular numbers for their sum to be any number we please.
Did you notice from his dates that he was only aged 19 at the time he proved this?
The result was indeed true, but even Euler could not find a proof although he found many relationships between the Polygonal numbers. It was not until Gauss published his Disquisitiones Arithmeticae in 1801 (see the English translation below: ) that the first proof appeared in print as article 293. He writes (translated):
the previous arguments also provide a demonstration of that famous theorem: any positive integer can be decomposed into three trigonal numbers. It was discovered by Fermat but until now there has been no rigorous proof for it.

The 3 Triangular Numbers Representation Calculator

C A L C U L A T O R :  3 Triangular   N u m b e r s

all lists of up to 3 triangular numbers with sum
up to


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

/ You Do The Maths...

    1. First, make a list of the Triangular numbers up to 100
      either using the Triangle Number calculator above
      or by hand: by starting at 1, then adding 2 to get the next and adding 3 onto that to get the fourth, then add 5, and so on. Check your list here: A000217
    2. Now make a list of as many numbers as you can, writing each as the sum of no more than 3 triangular numbers.
  1. Some numbers need 3 Triangular numbers in their sum. For instance
    5=1+1+3 and 8=1+1+6.
    are not the sum of any smaller set of Triangular numbers.
    What are the next two numbers that need 3 triangular numbers?
    Check your answer here:A020757

Sums of Square Numbers

We need at least four squares to be summed to produce numbers such as
 7 = 1 + 1 + 1 + 22
15 = 1 + 1 + 22 + 32
23 = 1 + 22 + 32 + 32
No smaller number of squares will do.
If the next is 28 which 4 squares sum to 28?
The series is 7,15,23,28,31,39,47,55,60,... A004125.

/ You Do The Maths...

  1. Can you find a number that needs 5 or more squares?
  2. What about the Pentagonal Numbers 1,5,12,22,35,...?
    What is the smallest size that you can find so that every number will be the sum of a set of Pentagonal's of that size?
The answers are in the next section.

Sums of same shaped figurate numbers

In this section we will take a closer look at sums of figurate numbers where both the numbers summed and the total are of the same shape.
Is it possible that two triangular numbers can sum to a triangular number? What about squares? and Pentagonals and other shapes of polygon?
For the other polygonal numbers, a little searching reveals the following: Did you spot a pattern in the ranks for three different numbers of the same shape?
pn(r1) + pn(r2) = pn(r3)
32 2 3
43 4 5
54 7 8
65 11 12
76 16 17
Can you guess how the table continues?
Can you put this pattern into an algebraic equation and verify it?
The table continues:
pn(r1) + pn(r2) = pn(r3)
87 22 23
98 29 30
109 37 38
and the pattern is:
using T(r) = p3(r) = r(r+1)/2:
r1 = n - 1
r2 = T(n - 2) + 1
r3 = r2 + 1 = T(n - 2) + 2

or, as a single formula:
pn(n - 1) + pn( T(n - 2) + 1) = pn(T(n - 2) + 2)

We have just proved that

It is always possible to find two n-gonal numbers whose sum is a third n-gonal number
and, by rearranging the terms:
It is always possible to find two n-gonal numbers whose difference is a third n-gonal number

The n Polygonal Numbers Representation Calculator

C A L C U L A T O R :  n Polygonal   N u m b e r s

all lists of polygonal numbers with sum
up to


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

/ You Do The Maths...

  1. Find other triangular numbers that when doubled are triangular.
    Check your answer with A001652.
    How is this related to the oblong numbers that we saw above?
  2. We have seen that 2 p3(2) is triangular :
    2 p3(2) = p3(3) : 3 + 3 = 6 and also
    2 p5(5) = p5(7) : 35 + 35 = 70 .
    There are no solutions to
    2 p4(r) = p4(s) : 2 r2 = s2 or else √2 would be r/s, a rational number.
    1. Find a simple proof that √2 is irrational (search the web)
    2. Extend your proof to show √3 is irrational
    3. Investigate the polygonal number table or use the calculator below to find other values of n for which 2 pn(r) = pn(s)
  3. What about products? For which n, if any, are there n-gonal numbers whose product is n-gonal?
    This clearly applies to squares since a2 × b2 = (ab)2 but are there other shapes too where pn(a) × pn(b) = pn(c)?
  4. For a particular shape (n-gon), does the pattern in the table above continue?
    If it does, it will show that there an infinite number of such tripes for each shape
    If so, show how and what the formula is.
Some of the investigations here are better answered if we can determine directly is a given number has a certain shape. Let's have a look now at how to do that.

Fermat gives the answer!

The mathematician Fermat (1601-1665) in one of his notebooks wrote:
I was the first to discover the very beautiful and entirely general theorem that
every number is either triangular or the sum of 2 or 3 triangular numbers;
every number is either a square or or the sum of 2, 3 or 4 squares;
either pentagonal or the sum of 2,3,4 or 5 pentagonal number;
and so on ad infinitum...
Also, just as he did with his famous "Fermat's Last Theorem" he wrote:
I can not give the proof here... for I intend to devote an entire book to this subject and to effect in this part of arithmetic astonishing advances over the previous known limits
Unfortunately, the book never appeared but he did state this "theorem" also in letters to Mersenne in 1636 and to Pascal in 1654. [See references below to Dickson, Vol II, page 6].

What Fermat found is a very interesting result that, if we include the number 0 as a polygonal number of any shape:

This was first proved by Cauchy in 1815 (see History of the Theory of Numbers, vol II page 18) who also established that all but 4 of the polygonal numbers may be taken to be 0 or 1. In fact, for larger numbers, the situation is a good bit simpler than this very nice and easily remembered theorem, because Legendre proved that beyond a certain value of n every integer is a sum of just 4 p-gonal numbers when p is odd and, when p is even, every even integer big enough is a sum of just 5 and one of them is either 0 or 1.

If p is odd:
Every integer bigger than 28(p–2)3 can be written as a sum of 4 p-gonal numbers
If p is even:
all integers bigger than 7(p–2)3 can be written as a sum of 5 p-gonal numbers , one of which is 0 or 1.
The limits
odd p limit28 756 3500  ...
even p limit 56 448  1512...

The Polygonal Number Sums Calculator

C A L C U L A T O R :   P o l y g o n a l   N u m b e r   S u m s
Integer representations as sums of polygonal numbers

with lists of

whose smallest list has
two numbers and their sum all of which are
-gonal numbers with sum=

up to


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred
You can use the Calculator above to find:
Triangular Numbers:
The counts of the number of ways of writing n as a sum of up to 3 triangle numbers are :
1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 3, 2, 1, ... A002636
The 11 numbers that are the sum of just one set of up to 3 triangle numbers (all are less than 100).
0, 1, 2, 4, 5, 8, 11, 14, 20, ...See A060773.
The 38 numbers that are the sum of exactly 2 sets of up to 3 triangle numbers (all are less than 200).
3, 6, 7, 9, 10, 13, 15, 17, 18, 19, 23, ... See A071530.
Square Numbers:
The number of sets of (up to 4) squares with a sum of n is
Those numbers which are the sum of just one set of (up to 4) square numbers are:
1,2,3,5,6,7,8,11,14, 15, 23, 24, 32, 56,... A006431
Those which are the sum of exactly two such sets are:
Pentagonal Numbers:
Surprisingly, there are only 6 numbers that need 5 Pentagonals in their sum and all are less than 100.
9, 21, 31, 43, 55, 89
Hexagonal and higher
There seem to be a very small number of numbers that need p p-gonal numbers when p is 5 or more.
So Triangular and Square numbers are unusual in that there is an infinite list of numbers that need 3 Triangulars or that need 4 Squares in their sums.
Here are some more suggestions to start your own investigations:-

/ You Do The Maths...

  1. Make a list of the triangular numbers squared: p3(r)2 which begins 1, 32=9, 62=36, 102=100, ...
    1. What do you notice about the difference between one and the next?
      Can you now write down a formula for 13 + 23 + 33 + ... + n3 ?
    2. If you add two neighbours in the list, what do you notice (hint: look in the list of triangular numbers)?
    1. There are n people in a room, and each shakes hands with everyone else when they are introduced. How many handshakes were there?
    2. In a chess club (tennis, snooker, pool or any other two-person game) n people arrive for a tournament where everyone plays everyone else once. How many games are played in the tournament?
    3. Two people are needed to serve on a committee out of n possible candidates. In how many ways can the two people be chosen?
    4. What is the average of the first n Pentagonal Numbers?
    5. In a Dancing Competition involving n couples, everyone in the competition is on the floor dancing and being judged by a panel of judges. After each dance the judges decide on one couple to be eliminated from the rest of the competition. At the end of the event the couple remaining is the winner. How many separate couples performing a dance do the judges have to grade?
    6. Replace the dancing competition above by a Talent Show in which after each round, one entry is removed. How many acts are judged by the panel?

    Why is the answer to all these a Triangular number?
  2. Harder:
    The list of numbers that need 4 squares is infinitely long. Use the Polygonal Sums Calculator to find some by using
    whose smallest list has
    -gonal numbers with sum =
    up to
    There is a simple condition to test if a given number is in this list:
    First divide by 4 as often as you can
    then divide what is left by 8 and look at the remainder.
    What is the test condition?
  3. Is it true that there are pentagonal numbers that are the sum of two different pentagonal numbers?

Matchstick Numbers

Instead of using dots let's use matchsticks instead to make patterns.

Matchstick Squares

Here, for instance, are the Matchstick square numbers:
Can you find the pattern in this sequence of numbers?
What is the next number?
What is a formula for the number of matchsticks in a square of side n?

4, 12, 24, 40, ... A046092
2 n (n+1)

Matchstick Squares with Diagonals

If we squash our squares a little, we can make a rhombus (a 4-sided shape with all sides the same length) and have a matchstick as a diagonal.
These give rise to many other patterns and sequences.
Can you find the pattern in this sequence of numbers?
What is the next number?
What is a formula for the number of matchsticks in a square of side n?

5, 16, 33, 56, ... A045944
n (3n + 2) = 4 p3(n) + p4(n) = 4 T(n) + n2
Surprisingly, these numbers are the octagonal numbers with negative size! The number of matchsticks in a square of side r is p8(–r).
You can also investigate what happens to pn(–r) for the other polygons with negative rank. Can we give an interpretation to these numbers in terms of diagrams?

Matchstick Triangles

Let's see what we get if we form equilateral triangles with the matchsticks:
Can you find the pattern in this sequence of numbers?
What is the next number?
What is a formula for the number of matchsticks in a triangle of side n?

3, 9, 18, 30, ... A045943
3 n (n+1) / 2
which we see are also just 3 T(n).
These numbers also have a special overlapping runsum property:
the nth is the smallest number that is a sum of both n-1 and of n consecutive numbers:
9 = 2 + 3 + 4 = 4 + 5
18 = 3 + 4 + 5 + 6 = 5 + 6 + 7
30 = 4 + 5 + 6 + 7 + 8 = 6 + 7 + 8 + 9

House of Cards

Once we have the formula for Matchstick Triangles, it is easy to find the formula for a House of Cards:
HoC1 HoC1 HoC1 HoC1
Nb of cards271526
What is the next number?
What is a formula for the number of cards in a House of Cards of n tiers (n levels high)?

3, 9, 18, 30, ... A045943 are the Matchstick Triangle numbers 3 n (n+1) / 2
but we take 1 from the first, 2 from the second, ... n from the n-th, ... to get the series
3-1=2, 9-2=7, 18-3=15, 30-4=26, 40, 57,... A005449
with formula 3 n (n+1) / 2 – n = n (3n+1)/2
These numbers also have a runsum property: The nth is the sum of the next n numbers after n:
1st2 = 2
2nd7 = 3 + 4
3rd15 = 4 + 5 + 6
4th26 = 5 + 6 + 7 + 8
Can you also write each of these House of Cards numbers as a pronic number + a triangle number?
Take n from the nth House of Cards number. You should find a series that we have met before - but which is it?

n(3n+1)/2 = n(n+1) + n(n–1)/2
2-1=1, 7-2=5, 15-3=12, 26-4=22, ...
and 1,5,12,22,... are the Pentagonal Numbers

Matchstick Hexagons

We can extend our matchstick triangle patterns to hexagons:
Can you find the pattern in this sequence of numbers?
What is the next number?
What is a formula for the number of matchsticks in a hexagon of side n?

12, 42, 90, 156, ... A045945
3 n (3 n + 1)

/ You Do The Maths...

  1. Have a look at some of the books below to see even more of the amazing mathematics of these numbers.
  2. Make your own shape with dots and find an expression to give the number of dots for each "size" of your shape.

Runsums and Polygonal Numbers

All odd numbers are runsums since 2n + 1 = n + (n+1).

We have already seen that the triangular numbers are the sum of consecutive numbers starting at 1:

T(1) = 1
T(2) = 1 + 2 = 3
T(3) = 1 + 2 + 3 = 6
T(4) = 1 + 2 + 3 + 4 = 10
T(r) = 1 + 2 + ... + r = r(r+1)/2
T(r) is the sum of the first r numbers beginning at 1.

Not all square numbers are expressible as a runsum, that is as the sum of a run of consecutive numbers. The squares of the powers of 2 are not since they are clearly powers of two and no power of two is a runsum.
But the odd squares (2n+1)2 are a sum of 2n+1 consecutive integers with 2n+1 as the central number:

32 = 9 = 2 + 3 + 4
52 = 25 = 3 + 4 + 5 + 6 + 7
72 = 49 = 4 + 5 + 6 + 7 + 8 + 9 + 10
(2n+1)2 = (n+1) + (n+2) + ... + (n + (n+1)) + ... (n + 2n + 1)
(3 n)2 is always the sum of a run of 3 numbers:
32 = 9 = 2 + 3 + 4
62 = 36 = 11 + 12 + 13
92 = 81 = 26 + 27 + 28
(3n)2 = 9 n2 = (3 n2 – 1) + (3 n2) + (3 n2 + 1)

The Pentagonal numbers have very nice expressions as runsums that we saw in pictures above:

p5(1) = 1
p5(2) = 2 = 2 + 3
p5(3) = 12 = 3 + 4 + 5
p5(4) = 22 = 4 + 5 + 6 + 7
p5(r) = r(3r–1)/2 = r + (r+1) + ... + (2r–1)
We see that p5(r) always has a runsum of length r being the sum of the r numbers starting at r itself.

The hexagonal numbers are also the odd-ranked triangular numbers and we know the triangular numbers have simple runsums.

p6(r) = r(4r–2)/2 = 1 + 2 + ... + (2r–1)
So the sum of the first 2r–1 numbers is the hexagonal number p6(r) of rank r.

And the heptagonal (7-sided) numbers also have interesting representations as runsums:

p7(1) = 1
p7(2) = 7 = 3 + 4
p7(3) = 18 = 5 + 6 + 7
p7(4) = 34 = 7 + 8 + 9 + 10
p7(r) = r(5r–3)/2 = (2r–1) + (2r) + (2r+1) + ... + (2r + r–2)
p7(r) is the sum of r numbers starting from the r-th odd number 2r–1

The octagonal numbers p8(r) = r(3r–2): 1, 8, 21, 40, 65, ... may not seem to have any obvious runsum connections. The lack of results here is due to the fact that some octagonal numbers have just one expression as a runsum:

p8(4) = 40 = runsum(6,10)
p8(6) = 96 = runsum(31,33)
p8(8) = 176 = runsum(11,21)
p8(16) = 736 = runsum(21,43)
p8(22) = 1408 = runsum(123,133)
p8(32) = 3008 = runsum(41,87)
where runsum(a,b) = a + (a+1) + ... + b.

The nonogonal numbers, 9-sided polygonal numbers, 1, 9, 24, 46, ... r(7r–5)/2 have again another pattern:

p9(1) = 1
p9(2) = 9 = 4 + 5
p9(3) = 24 = 7 + 8 + 9
p9(4) = 46 = 10 + 11 + 12 + 13
p9(r) = r(7r–5)/2 = (3r–2) + (3r–1) + (3r) + ... (3r + r–3)
p9(r) is the sum of r numbers starting from (3r–2)

Polygonal Runsums Calculator


: -gonal
: prime numbers
: oblong numbers
: rectangular numbers


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred
The Calculator above will help with the following investigations:...

/ You Do The Maths...

  1. Square numbers:
    1. Which square numbers have a runsum of the form runsum(a,a+2) = a+(a+1)+(a+2) and why?
      (3n)2 = (3n–1) + (3n) + (3n+1)
    2. Which square numbers have a runsum of length 4? Explain your result.
      None do!
      If we divide the square numbers by 4 and look at the remainders, we only ever have remainders of 0 or 1:
      n2 mod 4010101...01
      But the sum of 4 consecutive integers is a + (a+1) + (a+2) + (a+3) = 4a+6 which when we divide by 4 has a remainder of 2, so such runsums are never square.
    3. Show that (5n)2 always has a runsum of length 5
      (5n)2 = runsum( 5n2–2, 5n2+2 )
    4. Generalise the above results for square numbers with runsums of lengths 3 and 5.
      ((2k+1)n)2 = runsum( (2k+1)n2–k, (2k+1)n2+k ) The square of any multiple of an odd number has a runsum with that odd number as its length.
    5. Find a formula for the all the square numbers that have a runsum of length 9.
      (3n)2 = runsum( n2–4, n2+4 )
    6. Prove that (4n + 2)2 is always the sum of 8 consecutive numbers
      (4n + 2)2 = 16n2 + 16n + 4 = runsum( 8n–7, 8n )
  2. Pentagonal Numbers:
    1. Looking at the pentagonal image above prove that p5(r) always has a runsum of length r starting at r itself.
      p5(r) = r(3r – 1)/2 = runsum( r, r+(r–1) )
    2. Apart from p5(4) which other pentagonal numbers have a runsum of length 4?
      There are two series:
      p5(8n–4) = 96n2 – 100n + 26 = runsum( 24n2–25n+5, 24n2–25n+8 )
      p5(8n–1) = 96n2 – 28n + 2 = runsum( 24n2–7n–1, 24n2–7n+2 )
    3. Which pentagonal numbers have a runsum of length 5?
    4. Which pentagonal numbers have a runsum of length 6?
    5. Can you generalise this?
    6. Find a pattern in the runsums for pentagonal numbers of rank 5,9,13,17,21,... 4r+1,....
      p5(4n + 1) = runsum( r+1, 7r+1 )
  3. Hexagonal Numbers:
    1. Find a pattern for a runsum for hexagonal numbers of ranks 3, 5, 7, 9, ..., 2r+1, ...
      p6(2r – 1) = runsum(3r–2, 5r–4)
  4. Heptagonal Numbers (7-gonal) of the form p7(r) numbers
    1. Do all heptagonal numbers p7(3r) with r≥2 have a runsum of length 9?
      p7(6r) = 9r ( 10r – 1) = runsum( 10r2 – r – 4 , 10r2 – r + 4 )
      p7(6r + 3) = 9 ( 10r2+9r+2 ) = runsum( 10r2+9r–2 , 10r2+9r+4 )
  5. Octagonal Numbers:
    1. Find a pattern in the runsums for p8(4r) if r>2.
  6. Odd polygons:
    Look at the runsums of length r that we found for pn(r) for the odd polygons n = 3, 5, 7, 9. Extend this to all odd n and find the formula.
  7. For which polygons n is it true that if r is prime then pn(r) has a runsum of length r?
  8. All oblong numbers have an even side and an odd side. Show that all oblong numbers are expressible as a runsum whose length is the odd side of the oblong:
    2×3 = 6 = runsum(1,3) length 3
    3×4 = 12 = runsum(3,5) length 3
    4×5 = 20 = runsum(2,6) length 5
    5×6 = 30 = runsum(4,8) length 5
    6×7 = 42 = runsum(3,9) length 7
    7×8 = 56 = runsum(5,11) length 7
    8×9 = 72 = runsum(4,12) length 9
    9×10 = 90 = runsum(6,14) length 9
    runsum(a–k,a+k) is a sum of a run of length 2k+1
    runsum(a–k,a+k) = (2k+1) a
  9. [Harder] The oblong number 6 is also a runsum starting at 1, as is the oblong number 210:
    2×3 = 6 = 1 + 2 + 3
    14×15 = 210 = 1 + 2 + ... 19 + 20
    1. Are there other solutions to a×(a+1) = 1 + 2 + ... + b?
      84×85 = 1 + 2 + ... + 119
      492×493 = 1 + 2 + ... + 696
      a is in A053141
      a+1 is in A011900
      b is in A001652
    2. How is this related to the Pythagorean Triangles with consecutive legs x and x+1?
      The values of b are the values of x in these triangles
    3. What is the recurrence relation that applies to the sequences of values of a, the series of values of a+1 and the sequence of values of b?
      s(n) = 6 s(n-1) – s(n-2) + 2 with different initial terms:
      s(0)=0, s(1)=3 gives the series of values of a
      s(0)=1, s(2)=3 gives the series of values of a+1
      s(0)=0, s(1)=2 gives the series of values of b

Centred Polygonal Shapes

Up to now, our shapes have grown outward from one corner. We have found many useful series and patterns that are used extensively throughout mathematics. But we can also make polygonal shapes that grow from the centre by adding a new layer all around the outside. Here is a table:
Centred Triangles
Shapes tri tri tri tri tri

Centred Squares
Shapes tri tri tri tri tri

Centred Pentagons
Shapes tri tri tri tri tri

Centred Hexagons
Shapes tri tri tri tri tri

/ You Do The Maths...

  1. Find the next number in each of the series in the tables above by looking at what we add to one number to get the next. Can you see why this is so from the diagrams?
  2. Find a formula for the Centred Triangle Numbers C3(r), Centred Square Numbers C4(r) and Centred Pentagonal Numbers C5(r).
  3. Find a formula for the Centred n-gonal numbers Cn(r)
  4. Can you find the formula for Cn(r) in terms of Triangle numbers T(n-1) from this pattern which uses shapes of side 6?
  5. Which polygonal shape corresponds to the following series of sums of odd numbers:
  6. Express this pattern using polygonal numbers:
    22 + 12 32 + 22 42 + 32 52 + 42
  7. Here is an alternative pattern for the even-shaped centred polygonal numbers. Can you use it express C2n(r) algebraically?

    2n = 4, r=6
    Square Centred

    2n = 6, r=6
    Hexagonal Centred

    2n = 8, r=6
    Octagonal Centred
Centred Polygonal Numbers Cn(r)
Triangularn=31 4 10 19 31 46½ (2 – 3r + 3r2) A005448
Squaren=41 5 13 25 41 61½ (2 – 4r + 4r2)
=1 – 2r + 2r2
Pentagonaln=51 6 16 31 51 76½ (2 – 5r + 5r2) A005891
Hexagonaln=61 7 19 37 61 91½ (2 – 6r + 6r2)
=1 – 3r + 3r2
2 – n r + n r2
= 1 + n r (r – 1)
* Note that these formulae are different to those in the OEIS as ours here use r as the number of dots on the side of the polygon.
Centred Polygonal Numbers Cn(r)

The Centred Polygonal Number Calculator

C A L C U L A T O R :   C e n t r e d   P o l y g o n a l   N u m b e r s
Numbers common to several Centred shapes

simultaneously: -shaped in the range

up to

Which polygonal shapes?

all Centred-polygon shapes for cn(r) =
exclude rank 2?

for centred -gonal


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

The Star Centred Figurates

The game of Chinese Checkers in played on a star-shaped board and leads to another nice series of shapes variously called
sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex
11337 73121
1, 13, 37, 73, 121, 181, 253 ... A003154
But these numbers are also the Centred 12-gonal numbers:
sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex

Each 12-gon is made up of 12 triangles plus an extra dot and can therefore be can be transformed into the corresponding star shape: for example...

Centred Polygonal Numbers versus Corner Polygonal Numbers

There are several important differences between the ordinary or corner polygonal numbers pb(r) and the centred polygonal numbers pb(r).

Integer Representations

Fermat's theorem above shows that we can represent any integer as a sum of polygonal numbers in many ways, as a sum of 3 triangular numbers or a sum of up to 4 square numbers, or 5 pentagonal etc. This is not true for centred polygonal numbers as the numbers are too far apart.
For instance, with centred triangular numbers:
1, 4, 10, 19, 31, 46, ...
7 needs at least 4 centred triangle numbers: 7 = 4 + 1 + 1 + 1, and
17 needs at least 5 centred triangle numbers: 17 = 10 + 4 + 1 + 1 + 1.
For centred square numbers:
1, 5, 13, 25, 41, 61
9 needs at least 5 centred square numbers: 9 = 5 + 1 + 1 + 1 + 1, and
22 needs at least 6 centred square numbers: 22 = 13 + 5 + 1 + 1 + 1 + 1.

As sums of triangular numbers

The cornered n-gonal polygonal numbers are made up of n-2 (cornered) triangular numbers of rank r-1 plus (a line of) r:
pn(r) = r + (n – 2) r(r–1)
= 2 T(5) + 6
= 3 T(5) + 6
= 4 T(5) + 6
= 5 T(5) + 6
= 6 T(5) + 6
whereas a centred n-gonal polygon is made up of n (cornered) triangular numbers of rank r-1 plus an extra 1:
cn(r) = 1 + n r(r–1)
which is an easy way to remember their formulae.
The centred polygonal numbers formula is illustrated by these dot-diagrams from the You Do The Maths... question above:
= 3 T(5) + 1
= 4 T(5) + 1
= 5 T(5) + 1
= 6 T(5) + 1
= 7 T(5) + 1

The Plain and Centred Polygonal Number Calculator

C A L C U L A T O R :   P o l y g o n a l   N u m b e r s - Plain and Centred
Numbers common to several shapes

-shaped and
centre-shaped in the range
show their ranks too?

up to


calculator: Triangular Square Rectangular,Prime Polygonal Multi-polygonal Polygonal Sums Runsums Centred Plain&Centred

Polygonal Number Facts

A Perfect number is one which is the sum of all of the divisors smaller than itself:
  1. 6 has divisors 1, 2, 3 and 6 and 1 + 2 + 3 = 6
  2. 28 has divisors 1, 2, 4, 7, 14 and 28 and 1 + 2 + 4 + 7 + 14 = 28
The perfect numbers are 6, 28, 496, ... A000396.
All the even Perfect Numbers are Hexagonal!
Euclid (book IX Proposition 36) proved that all even perfect numbers must be of the form 2p–1(2p–1) provided that 2p–1 was a prime number.
Such primes are called Mersenne Primes (for a general value of p they are called the Mersenne numbers) :
3, 7, 31, 127, 2047, ... A001348
For 2p–1 to be prime then p must be a prime number.
It is not known if there are any odd perfect numbers.

p6(r) = r ( 2r – 1).
If we let r = 2p then we see all even Perfect numbers are hexagonal.

If we multiply the infinite product (1+x)(1+x2)(1+x3)... by the infinite product (1–x2)(1–x4)(1–x6)... the result is a polynomial that is a just a sum of powers of x and those powers are all the Triangle numbers:

(1 + x)(1 + x2)(1 + x3)... × (1 – x2)(1 – x4)(1 – x6)...
= 1 + x + x3 + x6 + x10 + x15+...
There is also an expression for the infinite polynomial with triangle number coefficients:
x  = x + 3x2 + 6x3 + 10x4 + ...
( 1 − x )3
This is called the generating function for the triangle numbers. The coefficient of xn is T(n), the n-th triangle number.
The equation is true numerically only when x < 1.
For instance put x=2 in this equation and the left-hand side is 2 / (-1)3 = -2, which is negative whereas the right-hand side is a sum of purely positive terms and must be positive.
But provided the size of x is less than 1 (−1 < x < 1) then it is true numerically also.

So let's see what happens if we put in a valid number for x: let x = 1/100. We can then multiply top and bottom of the left-hand side by 1003 to get a decimal fraction from the triangle numbers:

1/100 = 10000 = 10000 = .01 + .0003 + .000006 + .00000010 + ... = 0.01 03 06 10 15 ...
We have found a decimal value made up of the triangle numbers written in order and also shown it is an exact fraction. Since we take the triangle numbers with just 2 decimal places each, they soon start to overflow and eventually the triangle numbers are not so easily seen. In fact, the pattern will eventually repeat in a periodic fashion and we see this same initial pattern reappear!
This is explained with much more on my Fractions and Decimals page.

/ You Do The Maths...

  1. The generating function for the square numbers is
    x ( 1 + x ) = x + 4x2 + 9x3 + 16x4 + ...
    ( 1 – x )3
    1. What proper fraction has as its decimal expansion the number 0.01 04 09 16 25 36 ...?
    2. What proper fraction would give 0.001 004 009 016 025 036 ...?
  2. For the Pentagonal Numbers we have
    x ( 1 + 2 x ) = x + 5x2 + 12x3 + 22x4 + ...
    ( 1 – x )3
    1. What proper fraction has as its decimal expansion the number 0.01 05 12 22 35 ...?
    2. What proper fraction would give 0.001 005 012 022 035 ...?
  3. For the hexagonal numbers, the generating function is
    x ( 1 + 3 x ) = x + 6x2 + 15x3 + 28x4 + ...
    ( 1 – x )3
    1. Looking at all the generating functions above, guess the Generating Function for the n-gonal numbers.
    2. Take the pattern back to the one before the triangular numbers. What fraction for x do you get? What is the series of coefficients of this fraction ?

Pyramids: Number Shapes as Solids in 3 dimensions

Let's move into three dimensions and to start off, look at Pyramid Numbers since these are related to the Polygonal Numbers. Here are three views of a stack of 5 squares making a Square-based Pyramid:
Square based Pyramid of 5 layers
Side viewExpanded view of layersTop view
and here is a Pentagonal-based Pyramid of height 5:
side view top view
The layers are just the pentagonal numbers we saw earlier:
shape tri
You can see that each layer is one of our polygonal images, and a Pyramid of r layers has one each of the polygonal numbers with rank from 1 to r. We will denote these as Pn(r) using a capital P for our 3D shapes and the small p is used pn(r) for the 2D polygonal numbers we looked at earlier.
Since we stack r layers to make a pyramid of height (or rank) r, we have the definition:
Pn(r) = pn(1) + pn(2) + ... + pn(r-1) + pn(r)

For the Polygonal numbers, we summed arithmetic series, accumulating sums from the beginning,

1, 2, 3, 4, 5, ... to get the series 1, 3, 6, 10, 15, ... The Triangular numbers
1, 3, 4, 7, 9, ... to get the series 1, 4, 9, 16, 25, ... The Square numbers
1, 4, 7, 10, 13, ... to get the series 1, 5, 12, 22, 35, ... The Pentagonal numbers
and so on
If we now do the same thing but sum the polygonal number series, we get the Pyramid Numbers. If we stack Triangles on top of each other, we make a pyramid which has a Triangle on each layer, and so on.
1, 3, 6, 10, 15, ... to get the series 1, 4, 10, 20, 35, ... The Triangular Pyramid numbers
1, 4, 9, 16, 25, ... to get the series 1, 5, 14, 30, 55, ... The Square Pyramid numbers
1, 5, 12, 22, 35, ... to get the series 1, 6, 18, 40, 75, ... The Pentagonal Pyramid numbers
and so on
Here are some simple examples of Pyramid Numbers. How many objects in each picture? Write each in Pn(r) form.
oranges plums apples tins 1 tins 2
4=P3(2) 5=P4(2) 6=P5(2) 14=P4(3) 20=P3(4)

More dimensions and Pascal's Triangle

The Triangular shapes of 2D and 3D are part of a more general pattern:
We could even invent a 2D version since each row is formed by summing the items on the previous row from the beginning up to that column, and continue with a Fourth Dimension and Fifth too, although it would be difficult to see how we could represent these in a (2D) diagram:
2: p3(r)136101521
If we look at the upwards diagonals in this table starting each in the leftmost column you might find that this new triangle of numbers is one you have met before:

/ You Do The Maths...

  1. You are working in a greengrocers shop and have just arranged the new batch of oranges into in a polygonal pyramid of 3 layers. The shopowner says he now wants them rearranging into a square-based pyramid. You manage to arrange them all as he requires with none left over. How many oranges could you have had? What was the polygon shape that you used in your original pile?
  2. Why is it much easier to arrange round fruit in layers which are Hexagonal polygon numbers?
    Make a list of all the Hexagonal Pyramid Numbers up to 100.
    Check your answer with A002412
  3. Find a formula for the Pyramid Number Pn(r).

References and Further Reading

Valid HTML 4.01! © 2015-2016 Dr Ron Knott email
launched 1 March 2015, updated 19 March 2017