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
Tn+1 = Tn+n, with T0=0, or :
0, 1, 3, 6, 10, 15, 21, ...
A triangular number is then the sum of the first n integers, that is :
Tn = n(n+1)/2
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.
T2n = 3Tn + Tn-1
T2n+1 = 3Tn + Tn+1