Polygonal and Figurate Numbers or Numbers as Shapes

We call some numbers square numbers because they can be arranged into a square shape. Here we look at other polygons of dots such as triangles, pentagon and so on - the polygonal numbers. Such polygons are flat and two-dimensional but we can extend the idea to three and even to higher dimensions or to other falt shapes that are not regular polygons, such as rectangles or star shapes and these are called figurate numbers. They have been an object of interest for mathematicians since the time of the Ancient Greek mathematicians such as Pythagoras around 500BC and Hypsicles circa 150BC and later Diophantus around 250AD and on to mathematical giants such as Fermat (1601-1665) and Euler (1707-1783).
They still provide an excellent vehicle for spotting intriguing number patterns, proof using algebra at school lever as well as "proofs without words".

A follow-on page covers polygonal shapes made of sticks or dots arranged centrally and also in 3D shapes or higher dimensions.

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:

One 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?
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.

Introducing the Polygonal Numbers...

We introduce the numbers which have a triangular pattern, then squares and pentagonal and so on. If the sides are straight then the shape is "polygonal". For Oblong and Rectangular numbers, not all the sides have the same length.

Notation for Polygonal Numbers

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)

The Triangle Numbers

We start with a triangle with a 1 dot,
then a triangle with two dots on each side, giving a shape with 1+2 = 3 dots,
then 3 dots on a side with a total of 1+2+3 = 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
side123456
shape tri tri tri tri tri tri
size136101521
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

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

Another Example of the Triangle Numbers T(n)

Here's an illustration of the Triangle numbers that is at first not an obvious one for these numbers.

Suppose we have a single line of cars waiting at traffic lights.

Cars A B C queue at the lights
As the lights change there may be one or two or more cars that get through each time before they change to STOP.

In how many ways can N cars get through the lights before they change to STOP if at least one car gets through each time the lights are on GO?

There are two obvious cases: they all get through the first time or else perhaps only one gets through each time needing as many light changes as there are cars, but there are other possibilites too.
For instance, with 3 cars, let's call them A, B and C, we can have:

Now let's look at the sequences of cars possible on a single change of lights across all the possibilities above:
ABC, AB, BC, A, B, C
making a total of 6 possible sequences of 3 cars passing through through the lights.
For n cars at lights on a single lane road there are T(n) possible sequences of cars that can pass through the lights each time the lights are GO
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?
      If the numbers are 1, 2, ..., n then
      • we can choose to start a sequence of 1 number in n ways
      • we can choose to start a sequence of 2 consecutive numbers in n-1 places
      • we can choose to start a sequence of 3 consecutive numbers in n-2 places
      • ...
      • we can choose to start a sequence of n-1 consecutive numbers at 2 places
      • there is only one way to include all the numbers
      So the total number of ways is n+(n-1)+(n-2)+...+2+1 - T(n)
    3. Why is this the same problem as the number of ways of inserting one pair of brackets in a sequence of n items? For example, for 3 items A, B and C we have:
      (ABC), (AB)C, A(BC), (A)BC, A(B)C, AB(C)
      The argument is similar to the first question about subsequences of consecutive items in a set:
      There can be just 1 or else 2 or 3 or all the way up to all n items within the single pair of brackets.
      After we place the opening bracket then, given the size of the collection inside, the closing bracket's place is fixed.
      The same reasoning now applies as for the subsets of consecutive numbers above.
  1. In how many ways can I choose 2 items from a collection of different items of size:
    1. 3
    2. 4
    3. 5
    4. 100
    For n items we can choose the first in n ways.
    that leaves n−1 items as the second choice except that if we choose A then B it is the same choice as if we chose B then A.
    So each pair will be chosen twice.
    The total number of pairs is therefore
    n (n−1)
    2
    The answers are therefore the triangular numbers T(n):
    1. 3×2/2 = 3 = T(2)
    2. 4×3/2 = 6 = T(3)
    3. 5×4/2 = 10 = T(4)
    4. n×(n−1)/2 = T(n)
  2. Can you explain why these two questions are related?
    If we take the first and last of each subset of the first question, we will have all the ways of choosing two from a collection of n (numbers).
    For example:
    subset 1 2 3 4 5 6 7 8 ⇔ choose items in positions 3 and 7 from 8 items.
    The same argument applies if the pairs (ordered with smallest first) of the second question are used as starting and ending points for the subsets of the first question.

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.
C A L C U L A T O R
triangular numbers in the range from up to
optional
R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

/ 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
side123456
shape tri tri tri tri tri tri
size149162536
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. Here we are interested in exact squares - rectangles are considered later - and here are some examples:
OS maps
Maps  
square tiles
Tiles

dice 4
Dice

domino 4:4
Dominoes

chessboard
Chess

graph paper
Graphs

A Square Number Calculator

To find the square of (a range of) numbers, use .
To find if a number is an exact square, use and put your number in the .
The "up to" number is optional.
C A L C U L A T O R
up to
R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

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.
Prime numbers are the non-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
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.

Everyday examples of Rectangular Numbers

6 eggs in a box

The number of ways of writing n as a Rectangular number

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) because all sides of a Rectangular number must be bigger than 1. Thus we have
n123456789101112...
Rectangles...2×2.2×3.2×43×32×5.2×6
3×4
...
Counts000101011102A072670

Highly composite numbers

4 is the smallest Rectangular number and is also square
4 = 2×2;
but 6 is the smallest purely rectangular number (it is not the square of a 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):
1×2=22×3=63×4=124×5=205×6=30
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

C A L C U L A T O R

between and

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

/ 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 rectangles and so does
    30 = 21 × 31 × 51 but
    72 = 23 × 32 has 5.
  5. What is the average of two consecutive oblong numbers?
    The average of n(n-1) and n(n+1) is n2
  6. What is the sum of the reciprocals of the first n oblong numbers?
    1 = ?
    2
    1 + 1 = ?
    26
    1 + 1 + 1 = ?
    2612
    ...
    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 the sum of all the reciprocals is 1.
  7. 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?
    If the strip has positions labelled 1 to n+1 then there are n ways to place the domino because its left-hand square can go on position 1 or 2 or .... or n.
    The domino sits on 2 squares which leaves (n+1)−2 = n−1 places for the square to go.
    So there is a total of n x (n−1) ways to place both the domino and the square and this is an oblong number.
  8. Generalize this pattern using the same oblong number four times and one extra central dot

    4 oblongn + 1 = 4 n(n+1) + 1
    = 4n2 + 4n + 1 = (2n+1)2
    a square with sides of 2n+1 dots.

  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?

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.
side123456
shape tri tri tri tri tri tri
size1512223551

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

The Hexagonal Numbers

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

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

/ You Do The Maths...

  1. 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
    ...
    Express this series using algebra and prove it.
  2. I have an even number of pencils on my desk. I choose 2 at random. How many different pairs can I choose? Why is this a hexagonal number?
    What if I had an odd number of pencils to choose 2 from?
    How are these two series related?

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.

/ You Do The Maths...

  1. Make a table of the first few numbers that end in 7. For each number, square it, then subtract 9 and finally divide by 40.
    What number series do you get?
    x71727374757...
    squared49289729136922093249...
    take away 940280720136022003240...
    divide by 401718345581...
    The last line is the 7-gonal numbers (heptagonal numbers)
  2. Take 3 consecutive numbers with the last one being a multiple of 3, for example 4×5×6.
    Divide their product by their sum. for examples 4×5×6/(4+5+6).
    Try this for other sets of 3 such consecutive numbers.
    Which polygonal number series do you get?
    1×2×3/(1+2+3) = 1
    4×5×6/(4+5+6) = 8
    7×8×9/(7+8+9) = 21
    10×11×12/(10+11+12) = 40
    The octagonal numbers.

  3. Which octagonal numbers are even?
    Divide these by 8; do you recognize the series of quotients?
    even
    octagonals
    84096176280...
    ÷815122235... the pentagonal numbers

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 formulas from number pattern pictures

Here you can have a go at finding the formulas 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
side123456
shape tri tri tri tri tri tri
size136101521
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 )
2


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 formulas 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
Success!
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:
side23456
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:
side123456
shape tri tri tri tri tri tri
size1615284566
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. So in column r we have
pn(r) = pn-1(r) + r(r-1)/2 for n>2
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.

Some formulas 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:
p6(6)p7(6)p8(6)
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
2

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)
 1234567rOEIS
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
=n
½ 3(2n−2)
=3n−3
½ 4(3n−4)
=6n−8
½ 5(4n−6)
=10n−15
½ 6(5n−8)
=15n−24
½ 7(6n−10)
=21n−35
½ r( (n−2)r − (n−4) )
= ½ r( (r−1)n − (2r−4) )
OEISA000027A008585 A016957A017329 A139606A139607
The Polygonal Numbers pn(r)
nr23456789101112131415
33610152128364555667891105120
449162536496481100121144169196225
55122235517092117145176210247287330
661528456691120153190231276325378435
7718345581112148189235286342403469540
8821406596133176225280341408481560645
99244675111154204261325396474559651750
1010275285126175232297370451540637742855
1111305895141196260333415506606715833960
121233641051562172883694605616727939241065
1313367011517123831640550561673887110151170
1414397612518625934444155067180494911061275
15154282135201280372477595726870102711971380
16164588145216301400513640781936110512881485
171748941552313224285496858361002118313791590
1818511001652463434565857308911068126114701695
1919541061752613644846217759461134133915611800
20205711218527638551265782010011200141716521905

We now have these formulas 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
2
(A)
=
r (r – 1) n – 2r + 4
2
(B)
=
nr (r – 1) – r (r – 2)
2
(C)
=
r + (n – 2) r (r – 1)
2
(D)
=
r(2 + (n − 2)(r −1))
2
(E)
=
r (r + 1)+ (n – 3)r (r – 1)
22
(F)
=
(n – 2) r2 – (n – 4) r
2
(G)
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 = pn−1(r) + p3(r−1)  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
 
pn(r) = p3(r) + (n−3) p3(r−1)  if n>3, r ≥ 1 (R3)
p3(r) = r(r+1)/2  if r ≥ 0
 
pn(r) = (n−2) p3(r−1) + r  if n ≥ 3, r > 0 (R4)
p3(0) = 0

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.
Polygonal Numbers C A L C U L A T O R
-gonal between and

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

Proofs Without Words

Several of the patterns we have seen above are just "Proofs without words" in that they demonstrate a mathematical property true for an infinite collection of shapes though the picture is of just one example.
Such patterns can also be verified quite easily using algebra and applying 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 formulas of the previous section, to provide a proof that your pattern formula is 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
K
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
1
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
1
11+2
+1
1+2+3
+2+1
1+2+3+4
+3+2+1
1+2+3+4+5
+4+3+2+1
1+2+3+4+5+6
+5+4+3+2+1
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
11+31+3+51+3+5+71+3+5+7+91+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
14+1=59+3=1216+6=2225+10=3536+15=51
Summing the n numbers starting from n
sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex sq+2tri=hex
12+33+4+54+5+6+75+6+7+8=9
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)
    6
    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 ...
    1410203556...A000292
    #∇01371322...A002623
    Total1513274878... A002717

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
hex3
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
n34567891011121314151617181920...
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 formulas 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 (E) above we have:
pn(r) = r(2 + (n − 2)(r −1))
2
Given the value of k, to find n and r such that k = pn(r) using the formula
2 k = 2 + (n − 2)(r −1)
r
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
The method is:
  1. take a factorisation with the smaller factor being r and the larger factor call F
  2. take 2 from F
  3. If F-2 is divisible by (r−1) then this value is n-2
  4. Add 2 to find n
Ways in which 28 is polygonal
2K =factors=
r ×F
F-2(F-2)/(r-1)=n-2npn(r)=K
58 = 2×282626/1=2628p28(2) = 26
4×141212/3=46 p6(4) = 26
7×8 6 6/6=1 3 p3(7) = 26
28 is polygonal in three ways

p28(2)

p6(4)

p3(7)
NOTE that sometimes a factorisation of 2k produces a value of n that is not an integer, for example when k=12:
Ways in which 12 is polygonal
2K =factors=
r ×F
F-2(F-2)/(r-1)=n-2npn(r)=K
24 = 4×644/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) formulas above and rearrange it to find r given n and the number pn(r).
pn(r) = r( (n–2)r – n + 4 )
2
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.
Rearranging:
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 Polygonal Number Shape-finder Calculator

C A L C U L A T O R :   F i n d   s h a p e s
all Polygonal shapes for numbers

up to

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

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

Since 1 is the first polygonal number of any and every shape, then we can add n 1's to make any number n!
But here we ask if there is a fixed number of polygonal numbers of the same shape - a list of a limited size - whose sum is any number whatsoever?

Sums of Triangular Numbers

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
    22
    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 formulas 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!

What 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 in the sum 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, "I've found it! Every number is the sum of 3 triangular numbers! ". He had found the first proof.
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 Sum-of-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 triangular numbers with sum
up to

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

/ 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 (3)
      • adding 3 onto that to get the next (6)
      • then add 4
      • and so on increasing the number added each time.
      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 - they are neither triangular not can they be made by adding two triangular numbers. For instance
    5=1+1+3 and 8=1+1+6 are not the sum of any smaller lists of Triangular numbers.
    Check that the next two are 14 and 17 and then find the next two numbers.
    Hint: make a list of all the numbers found by adding two triangular numbers from the list 0,1,3,6,10,... .
    Check your answer here:A020757

Sums of Square Numbers

We have just 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? Are all numbers a sum of some squares?

Two Squares sum to make another square - Pythagoras!

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.

Some numbers need more than two squares

It turns out that we need at least four squares then we can find a sum of squares for any number:
 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)
nr1r2r3
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)
nr1r2r3
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

/ 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
p:345678...
odd p limit28 756 3500  ...
even p limit 56 448  1512...

The Polygonal Number Sums Calculator

The representations of a number n here are lists of up to p p-gonal numbers with sum n.
Pythagoras' theorem applies to square number - two square numbers whose sum is a square. The final section of this Calculator lets you extend this to find two triangular numbers whose sum is triangular or to two pentagonswith pentagonal sum and to any other polygonal shape.
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
Find representations

Find numbers with several representations

with representations of
The size of the smallest representation

whose smallest representation has
Generalising Pythagoras' theorem to polygonal numbers
two numbers and their sum all of which are
-gonal numbers
with sum=

up to

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums

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
1,1,1,2,1,1,1,1,2,2,1,2,2,1,1,2,2,3,2,2,2,...A002635
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:
4,9,10,12,13,16,17,19,20,21,22,...A180149
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?
      They are the cubes
      1936100...
      8=2327=3364=43...
    2. Can you now write down a formula for 13 + 23 + 33 + ... + n3 ?
      13 + 23 + ... + n3 = p3(n)2
    3. If you add two neighbours in the list of squared triangular numbers, what do you notice (hint: look in the list of triangular numbers)?
      p3(r−1)2 + p3(r)2 = p3(r2)
    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. A Talent Competition starts with n acts, each judged by a panel of judges. After each round the judges decide on one act to be eliminated from the rest of the competition. Then the remaining acts compete again in the next round until there is only one act remaining - the winner.
      If there is one round each week, how many weeks will the competition last?
      How many performances in total will the judges have seen?

    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 representation 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?
    1. Take any pentagonal number p5(r); let's call it P.
      Either factorize or find the roots of the quadratic 3 x2 − x − 2 P . What do you notice about the factors (roots)?
    2. What about the quadratic x2 − x − 2 p6(r) for different values of r?
    3. Can you find any other similar quadratics?

Multi-polygonal numbers

Can we find numbers that are both triangular and square?
How about a number that is both triangular and square and also pentagonal?
The answer to the first is YES we can find an infinite number of them but for the second question there are none!
This section explores numbers that have more than one shape - multi-polygonal numbers.

A Triangle Number that is also a Square

movie
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
32
It looks as if this formula shouldn't give whole number solutions, but it does!

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?

Triangular numbers that have another polygonal shape

Here is a table summarising which triangular numbers are square, or pentagonal, or another p-gonal shape:
poly
shape
the p3 numbersOEISNotes
41,36,1225,41616,...A001110
51,210,40755,...A014979
61,6,15,28,...A000384 all hexagonals are triangular
71,55,121771,...A046194
81,21,11781,...A046183
91,325,82621,...A048909
101,10,1540,...A133216
111 1 is the only number
121,105,561,...

Square numbers that have another polygonal shape

Square triangular numbers are covered in the previous section.
The numbers in the table here are both square and have another polygonal shape too:
poly
shape
the p4 numbersOEISNotes
51,9801,...,A036353
61,1225,...,A046177
71,81,5929,...,A036354
81,225,43681,...,A036428
91,9,1089,...,A036411
101, there is only 1
111,196,29241,...,
121,64,3025,...,
Other numbers polygonal in two different ways can be found in the Calculator below
We can also look for numbers which have 3 polygonal shapes...

Is there a triangular number that is both square and pentagonal?

Apart from the obvious number 1, computer searches up to 1022166 (which is 1 followed by 22166 zeroes) have not found any.
The Mathworld link below points to a proof method that indicates there are indeed none except the number 1.

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
This Calculator ignores rank 2 polygonal numbers (a single ring of dots)
Numbers common to several shapes

simultaneously: -shaped in the range

up to
Numbers with many shapes
numbers having shapes in number range:
Show shapes?
Which polygonal shapes?

all Polygonal numbers in the range

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums
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 with this reference article:

Runsums and Polygonal Numbers

A runsum is a number which is the sum of a run of (consecutive, positive) whole numbers, for example: 12 because 12 = 3 + 4 + 5.
The sum of the whole numbers from a to b, b≥a, we will write as runsum(a,b) = a + (a+1) + ... + b and it uses b − a + 1 numbers in the sum, called the length of the runsum.
There is a lot more on these numbers on the introductory page on runsums in a new window at this site.

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.

Triangle differences: the Trapezoidal Numbers and Runsums

O
OO
OOO
OOOO
OOOOO
OOOOOO
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.

Other polygonal numbers and runsums

Not all square numbers are expressible as a the sum of a run of consecutive whole 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)

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

Polygonal Runsums C A L C U L A T O R
for -gonal numbers
between
and

R E S U L T S

calculator: Triangular Square Rectangular,Prime Polygonal Find shape sum of Triangular Polygonal Sums Multi-polygonal Runsums
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:
      n012345...2n2n+1
      n201491625...4n24n2+4n+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?
      Yes:
      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

The General or Second Polygonal Numbers

There is another series closely associated with the Polygonal numbers of a given order called the General(ised) Polygonal Numbers. They are the Polygonal numbers of a given order together with the number of internal points for each (the Second Polygonal numbers). Let's look at some examples:

Generalised Pentagonal Numbers

For example, the pentagonal numbers:
side123456
shape tri tri tri tri tri tri
size1512223551

1, 5, 12, 22, 35, 51, ... which is A000326
Excluding the outermost ring of dots, the number of internal dots is:
rank1 2 3 4 5 6 ... n
#dots1 5 12 22 3551 ... n(3n-1)/2, n>0
#outer1 5 10 15 20 25 ...5(n-1)
#internal
=#dots−#outer
0 0 2 7 1526 ... n(3n+1)/2, n≤0
both0,1,2,5,7,12,15,22,... n(3n-1)/2, n∈ℤ
Euler found the General Pentagonal numbers appearing in the expansion of a an infinite product: see below

General Hexagonal Numbers

For the hexagonal numbers:
side123456 n
shape tri tri tri tri tri tri
size1615284566 n(2n−1), n>0
The outer edge counts are 0, 6, 12, 18, 24, ... 6(n-1) so that the internal counts = #dots − #outer are 0, 0, 3, 10, 21, ..., n(2n-1),n≤0=n(2n+1)
and combining these with the (ordinary) hexagonal numbers gives the Generalized (Second) Hexagonal Numbers: 0,1,3,6,10,15,21,28,... which are just the Triangular numbers n(n+1)/2.

General Heptagonal Numbers

However for the heptagonal (7-sided polygonal) numbers:
#dots 1, 7, 18, 34, 55, 81, ..., n(5n − 3)/2 A000566
# external edge-points 0,7,14,21,28, ..., 7(n-1)
#internal points 0, 0, 4, 13, 23, 46, ... n(5n + 3)/2
General Heptagonal0,1,4,7,13,18,27,34,46 ... n(5n−3)/2 n≤0 and n>0A085787

Triangular and Square?

For these, the number of internal points is the same as an earlier smaller polygonal number of the same shape. The second and general triangular and square nunmbers are therefore just the ordinary triangular and square numbers.

A General Formula

The second n-gonal numbers are given by the formula for the ordinary n-gonal numbers but with negative rank r.
The general n-gonal numbers are by the ordinary n-gonal numbers formula but allowing the rank r to be both negative and positive.

Polygonal Number Facts

All even Perfect Numbers are hexagonal

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.

The infinite product (1-x)(1-x2)(1-x3)... and the Pentagonal Numbers

Euler proved that the infinite product of all the terms (1 − xn) with n going from 1 upwards, when expanded, gives only certain powers of x. The expansion begins:
1 − x − x2 + x5 + x7 − x12 − x15 + x22 + x26 − x35 − x40 + ...
There are three remarkable facts about this infinite series of powers of x: So we can express the infinite product purely in terms of pentagonal numbers:
(1 −xn) = (−1)kxp5(k)
Π Σ
n = 1k = −∞
When k = 0, p5(0) = 0 so xp5(0) = 1 and (−1)0 = 1 also. This gives the initial 1 in the expansion.

The capital pi symbol Π means we multiply all the terms (pi is the Greek letter "p" for product) for whole numbers n from 1 up to n=∞
and the capital sigma symbol Σ means we sum all the terms (sigma is the Greek letter "s" for sum) for all whole numbers k both positive an negative (from −∞ up to ∞).

Another Infinite product and the Triangle Numbers

If we multiply the infinite product (1+x)(1+x2)(1+x3)... above by the infinite product (1–x2)(1–x4)(1–x6)... the result is another polynomial with coefficients ±1 and whose powers of x are just the Triangle numbers:
(1 + x)(1 + x2)(1 + x3)...  ×  (1 – x2)(1 – x4)(1 – x6)...
= 1 + x + x3 + x6 + x10 + x15+...

Generating Functions

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 is between −1 and 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 ...
(99/100)3993970299
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.

Here is a table of generating functions for the other polygonal numbers

Trianglex = x + 3x2 + 6x3+...
(1−x)3
Squarex(1 + x) = x + 4x2 + 9x3+...
(1−x)3
Pentagonalx(1 + 2x) = x + 5x2 + 12x3+...
(1−x)3
Hexagonalx(1 + 3x) = x + 6x2 + 15x3+...
(1−x)3
k-gonalx(1 + kx)= pk(1)x + pk(2)x2 + ...
(1−x)3

/ 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 ...?
    Let x=0.01 = 1/100:
    0.01 + 4 (0.01)2 + 9 (0.01)3 + ... = 0.01 04 09 ... = 0.01 × 1.01= 10100
    0.993 970299

    Note that the later squares "overflow" into earlier squares' columns and so the decimal is actually: 0.01 04 09 16 25 36 49 64 82 012...

    Let x=0.01 = 1/1000
    0.001 + 4 (0.001)2 + 9 (0.001)3 + ... = 0.001 004 009 ... = 0.001 × 1.001= 1001000
    0.9993 997002999

    This time the overflow occurs much later in the decimal expansion when the squares reach 4 digits in length:
    302 = 900, 312=961 but 332 = 1024 so will "overflow" to the affect the square before:
    1001000 / 997002999 =
    0.001 004 009 016 025 036 049 064 081 100
      121 144 169 196 225 256 289 324 361 400
      441 484 529 576 625 676 729 784 841 900
      9620250901...

  2. Use the Pentagonal Numbers generating function from the table above:
    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. 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 ?

References and Further Reading


The MAIN PAGE for Dr Knott's Maths pages
Valid HTML 4.01! © 2015-2018 Dr Ron Knott email
launched 1 March 2015, updated 7 November 2018