In mathematics, a square triangular number (or triangular square number) is a number which is both a triangular number and a perfect square. There are infinitely many square triangular numbers; the first few are 0, 1, 36, 1225, 41616, 1413721, 48024900, 1631432881, 55420693056, 1882672131025 (sequence in the OEIS).
Write Nk for the kth square triangular number, and write sk and tk for the sides of the corresponding square and triangle, so that
Define the triangular root of a triangular number to be . From this definition and the quadratic formula, Therefore, is triangular if and only if is square. Consequently, a number is square and triangular if and only if is square, i. e., there are numbers and such that . This is an instance of the Pell equation, with . All Pell equations have the trivial solution (1,0), for any n; this solution is called the zeroth, and indexed as . If denotes the k'th non-trivial solution to any Pell equation for a particular n, it can be shown by the method of descent that and . Hence there are an infinity of solutions to any Pell equation for which there is one non-trivial one, which holds whenever n is not a square. The first non-trivial solution when n=8 is easy to find: it is (3,1). A solution to the Pell equation for n=8 yields a square triangular number and its square and triangular roots as follows: and Hence, the first square triangular number, derived from (3,1), is 1, and the next, derived from (17,6) (=6×(3,1)-(1,0)), is 36.