# Triangular number

This numbers are "figurative numbers" which may represent the number of stones in different geometric pictures.

The triangular numbers are number of stones set in triangles.

Square numbers are number of stones set in squares.

There are also pentagonal numbers, pyramidal numbers, cubic numbers (cubes) etc...

The triangular numbers are obtained by adding a side to the previous triangular number, that is
T_{n+1} = T_{n}+n, with T_{0}=0, or :

0, 1, 3, 6, 10, 15, 21, ...

A triangular number is then the sum of the first n integers, that is :
T_{n} = n(n+1)/2

## Some properties

Every square is the sum of two consecutive triangular numbers :

(n-1)n/2 + n(n+1)/2 = n²
For instance 10+15 = 25

Every number is the sum of three triangular numbers.

A script to decompose a number in sum of triangular numbers.

T_{2n} = 3T_{n} + T_{n-1}
T_{2n+1} = 3T_{n} + T_{n+1}