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 = m^{2} where m and n are integers. The left-hand side denotes a triangular number
and the right-hand side denotes a square number.

(n^{2} + n)/2 = m^{2}

n^{2} + n = 2m^{2}

Using the completing the square method,

(n + 1/2)^{2} - 1/4 = 2m^{2}

(2n + 1)^{2} - 1 = 8m^{2}

Let y =2m and x = 2n +1

Then, x^{2} -1 = 2y^{2} where x represents an odd number and y, an even number.

**x ^{2} - 2y^{2} = 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.

Maths is challenging; so is finding the right book. K A Stroud, in this book, cleverly managed to make all the major topics crystal clear with plenty of examples; popularity of the book speak for itself - 7^{th} edition in print.