# Triangle numbers

A number is a triangle number if we can arrange that number of objects into a triangle, like so:

The triangle number 10 is familiar to those who bowl: the ten bowling pins are arranged in a triangle. The triangle number 15 is familiar to those who shoot pool: at the break, the fifteen pool balls are arranged in a triangle.

If we count the objects in each row of the triangle, starting at the top, we see that the total number of objects in the triangle can be written as:

 1 = 1 3 = 1 + 2 6 = 1 + 2 + 3 10 = 1 + 2 + 3 + 4 15 = 1 + 2 + 3 + 4 + 5

So the 5-th triangle number is the sum of the first 5 integers, the 100-th triangle number is the sum of the first 100 integers, and so on.

### The legend of Gauss

There is a legend that the famous mathematician Gauss, when a child, was required by his teacher, as a punishment, to add up the numbers from 1 to 100. He started adding them from left to right
 1 + 2 + 3 +
Then he thought it might be easier to add them from right to left
 100 + 99 + 98 +
Writing these sums one underneath the other
 1 + 2 + 3 + 100 + 99 + 98 +
he noticed that the two numbers in each column added to 101, and that there were 100 columns, so if he did the sum twice and added the results he would get 100 times 101, or 10,100. Thus the sum must be half that: 5050.

### Calculating triangle numbers

This trick, ascribed to the child Gauss, works for any triangle number. Just as the 100-th triangle number is half of 100 times 101, the 5-th triangle is half of 5 times 6, or 15, and the 9-th triangle number is half of 9 times 10, or 45.

The ninth triangle number comes up in the Jewish festival of Hanukkah. On the first night of that holiday, two candles are lit, on the second night, three candles, and so on until the eighth and last night when nine candles are lit. So the number of candles you need to celebrate Hanukkah is 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9. This is one less than the ninth triangle number: you need 45 - 1 = 44 candles.

We can understand this calculation geometrically. First straighten up those triangles:

Now, make a duplicate of each triangle, turn it upside down and put it together with the original triangle to form a rectangle:

Each rectangle is one higher than it is wide, so the rectangle for the fifth triangle number is 5 by 6. The fifth triangle number is half of that rectangle: 30/2 = 15.

### Triangles and squares

Some numbers can be arranged in a triangle and can also be arranged in a square. That is, they are both triangle numbers and squares. The number 1 is considered to be such a number, but it's not too interesting. There is another one that is less than 100. Can you find it?

The number 1225 is the next such number (after the one less than 100 that you found):

1225 = 352 = (49·50)/2

What is the secret of this number? The important thing is that 49 is square and 50 is twice a square. Whenever we have two consecutive integers like that, we get a triangle number that is also a square. It's a triangle number because you can write it as (49·50)/2; it's a square because you can write it as 49·25 = 7·7·5·5 = 35·35.

With a little perseverance, and a calculator with a square root button, it's not too hard to find the next one. Take an odd number, like 7, and square it to get 49. Now check to see if the numbers on either side of 49 are twice squares: 48 is twice 24 which is not a square, but 50 is twice 25 which is. Of course we had that one. So try the next odd number, 9. The numbers on either side of 81 are 80, which is twice 40 (not a square), and 82, which is twice 41 (also not a square). So go on to 11, and continue until you succeed.