### Triangular Square Numbers

The numbers, which can be both triangular and square, are called triangular square numbers.

E.g. 36 is both triangular and square. 6, on the other hand, is triangular, but not square; 25, is a square, but not triangular.

Triangular numbers are given by the formula n(n+1)/2 where n >=1. The following programme, generates first 20 triangular numbers

Triangular Square Numbers can be derived in the following way.

(n)(n+1)/2 = m2 where m and n are integers. The left-hand side denotes a triangular number and the right-hand side denotes a square number.
(n2 + n)/2 = m2
n2 + n = 2m2
Using the completing the square method,
(n + 1/2)2 - 1/4 = 2m2
(2n + 1)2 - 1 = 8m2
Let y =2m and x = 2n +1
Then, x2 -1 = 2y2 where x represents an odd number and y, an even number.
x2 - 2y2 = 1

This is Pell Equation

Find pairs of (x,y) which satisfy the Pell Equation and the half of y value in each pair is the square root of a Triangular Square numbers.

Now, in order to generate first few triangular square numbers, please press the button.