When is a triangle a square?
Of course a triangle cannot be a square, but a triangular number can be a square number.
A triangular number is the sum of the first so many positive integers. For example, 10 is a triangular number because it equals 1+2+3+4. These numbers are called triangle numbers because you can form a triangle by having a row of one coin, two coin, three coins, etc. forming a triangle.
The smallest number that is both triangular and square is 1. The next smallest is 36. There are infinitely many numbers that are both triangular and square, and there's even a formula for the nth number that is both a triangle and a square:
((17 + 12a2)n + (17 - 12a2)n - 2)/32
Source: American Mathematical Monthly, February 1962, page 169.
For more on triangle numbers and their generalizations, see Twelve Days of Christmas and Tetrahedral Numbers.
There is also a way to compute the square triangular numbers recursively discussed in the next post.