# Square triangular number

For squares of triangular numbers, see squared triangular number.
Square triangular number 36 depicted as a triangular number and as a square number.

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 an infinite number of square triangular numbers; the first few are 0, 1, 36, 1225, 41616, 1413721, 48024900, 1631432881, 55420693056, 1882672131025 (sequence A001110 in OEIS).

## Explicit formulas

Write Nk for the kth square triangular number, and write sk and tk for the sides of the corresponding square and triangle, so that

$N_k = s_k^2 = \frac{t_k(t_k+1)}{2}.$

Define the triangular root of a triangular number $N = \frac{n(n+1)}{2}$ to be $n$. From this definition and the quadratic formula, $n = \frac{\sqrt{8N + 1} - 1}{2}.$ Therefore, $N$ is triangular if and only if $8N + 1$ is square, and naturally $N^2$ is square and triangular if and only if $8N^2 + 1$ is square, i. e., there are numbers $x$ and $y$ such that $x^2 - 8y^2 = 1$. This is an instance of the Pell equation, with n=8. All Pell equations have the trivial solution (1,0), for any n; this solution is called the zeroth, and indexed as $(x_0,y_0)$. If $(x_k,y_k)$ 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 $x_{k+1} = 2x_k x_1 - x_{k-1}$ and $y_{k+1} = 2y_k x_1 - y_{k-1}$. 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 $(x_k,y_k)$ to the Pell equation for n=8 yields a square triangular number and its square and triangular roots as follows: $s_k = y_k , t_k = \frac{x_k - 1}{2},$ and $N_k = y_k^2.$ 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.

The sequences Nk, sk and tk are the OEIS sequences , , and respectively.

In 1778 Leonhard Euler determined the explicit formula[1][2]:12–13

$N_k = \left( \frac{(3 + 2\sqrt{2})^k - (3 - 2\sqrt{2})^k}{4\sqrt{2}} \right)^2.$

Other equivalent formulas (obtained by expanding this formula) that may be convenient include

\begin{align} N_k &= {1 \over 32} \left( ( 1 + \sqrt{2} )^{2k} - ( 1 - \sqrt{2} )^{2k} \right)^2 = {1 \over 32} \left( ( 1 + \sqrt{2} )^{4k}-2 + ( 1 - \sqrt{2} )^{4k} \right) \\ &= {1 \over 32} \left( ( 17 + 12\sqrt{2} )^k -2 + ( 17 - 12\sqrt{2} )^k \right). \end{align}

The corresponding explicit formulas for sk and tk are [2]:13

$s_k = \frac{(3 + 2\sqrt{2})^k - (3 - 2\sqrt{2})^k}{4\sqrt{2}}$

and

$t_k = \frac{(3 + 2\sqrt{2})^k + (3 - 2\sqrt{2})^k - 2}{4}.$

## Pell's equation

The problem of finding square triangular numbers reduces to Pell's equation in the following way.[3] Every triangular number is of the form t(t + 1)/2. Therefore we seek integers t, s such that

$\frac{t(t+1)}{2} = s^2.$

With a bit of algebra this becomes

$(2t+1)^2=8s^2+1,$

and then letting x = 2t + 1 and y = 2s, we get the Diophantine equation

$x^2 - 2y^2 =1$

which is an instance of Pell's equation. This particular equation is solved by the Pell numbers Pk as[4]

$x = P_{2k} + P_{2k-1}, \quad y = P_{2k};$

and therefore all solutions are given by

$s_k = \frac{P_{2k}}{2}, \quad t_k = \frac{P_{2k} + P_{2k-1} -1}{2}, \quad N_k = \left( \frac{P_{2k}}{2} \right)^2.$

There are many identities about the Pell numbers, and these translate into identities about the square triangular numbers.

## Recurrence relations

There are recurrence relations for the square triangular numbers, as well as for the sides of the square and triangle involved. We have[5]:(12)

$N_k = 34N_{k-1} - N_{k-2} + 2,\text{ with }N_0 = 0\text{ and }N_1 = 1.$
$N_k = \left(6\sqrt{N_{k-1}} - \sqrt{N_{k-2}}\right)^2,\text{ with }N_0 = 0\text{ and }N_1 = 1.$

We have[1][2]:13

$s_k = 6s_{k-1} - s_{k-2},\text{ with }s_0 = 0\text{ and }s_1 = 1;$
$t_k = 6t_{k-1} - t_{k-2} + 2,\text{ with }t_0 = 0\text{ and }t_1 = 1.$

## Other characterizations

All square triangular numbers have the form b2c2, where b / c is a convergent to the continued fraction for the square root of 2.[6]

A. V. Sylwester gave a short proof that there are an infinity of square triangular numbers, to wit:[7]

If the triangular number n(n+1)/2 is square, then so is the larger triangular number

$\frac{\bigl( 4n(n+1) \bigr) \bigl( 4n(n+1)+1 \bigr)}{2} = 2^2 \, \frac{n(n+1)}{2} \,(2n+1)^2.$

We know this result has to be a square, because it is a product of three squares: 2^2 (by the exponent), (n(n+1))/2 (the n'th triangular number, by proof assumption), and the (2n+1)^2 (by the exponent). The product of any numbers that are squares is naturally going to result in another square. This can be seen from the fact that a necessary and sufficient condition for a number to be square is that there should be only even powers of primes in its prime factorisation, and multiplying two square numbers preserves this property in the product.

The triangular roots $t_k$ are alternately simultaneously one less than a square and twice a square, if k is even, and simultaneously a square and one less than twice a square, if k is odd. Thus, $49 = 7^2 = 2*5^2 - 1, 288 = 17^2 - 1 = 2 * 12^2$, and $1681 = 41^2 = 2 * 29^2 - 1.$ In each case, the two square roots involved multiply to give $s_k: 5 * 7 = 35, 12 * 17 = 204,$ and $29 * 41 = 1189.$[citation needed]

$N_k - N_{k-1}=s_{2k-1}: 36 - 1 = 35, 1225 - 36 = 1189,$ and $41616 - 1225 = 40391.$ In other words, the difference between two consecutive square triangular numbers is the square root of another square triangular number.[citation needed]

The generating function for the square triangular numbers is:[8]

$\frac{1+z}{(1-z)(z^2 - 34z + 1)} = 1 + 36z + 1225 z^2 + \cdots.$

## Numerical data

As $k$ becomes larger, the ratio $t_k/s_k$ approaches $\sqrt{2} \approx 1.41421$ and the ratio of successive square triangular numbers approaches $(1+\sqrt{2})^4 = 17+12\sqrt{2} \approx 33.97056$. The table below shows values of $k$ between 0 and 7.

$k$ $N_k$ $s_k$ $t_k$ $t_k/s_k$ $N_k/N_{k-1}$
$0$ $0$ $0$ $0$
$1$ $1$ $1$ $1$ $1$
$2$ $36$ $6$ $8$ $1.33333$ $36$
$3$ $1\,225$ $35$ $49$ $1.4$ $34.02778$
$4$ $41\,616$ $204$ $288$ $1.41176$ $33.97224$
$5$ $1\,413\,721$ $1\,189$ $1\,681$ $1.41379$ $33.97061$
$6$ $48\,024\,900$ $6\,930$ $9\,800$ $1.41414$ $33.97056$
$7$ $1\,631\,432\,881$ $40\,391$ $57\,121$ $1.41420$ $33.97056$

## Notes

1. ^ a b Dickson, Leonard Eugene (1999) [1920]. History of the Theory of Numbers 2. Providence: American Mathematical Society. p. 16. ISBN 978-0-8218-1935-7.
2. ^ a b c Euler, Leonhard (1813). "Regula facilis problemata Diophantea per numeros integros expedite resolvendi (An easy rule for Diophantine problems which are to be resolved quickly by integral numbers)". Memoires de l'academie des sciences de St.-Petersbourg (in Latin) 4: 3–17. Retrieved 2009-05-11. According to the records, it was presented to the St. Petersburg Academy on May 4, 1778.
3. ^ Barbeau, Edward (2003). Pell's Equation. Problem Books in Mathematics. New York: Springer. pp. 16–17. ISBN 978-0-387-95529-2. Retrieved 2009-05-10.
4. ^ Hardy, G. H.; Wright, E. M. (1979). An Introduction to the Theory of Numbers (5th ed.). Oxford University Press. p. 210. ISBN 0-19-853171-0. Theorem 244
5. ^
6. ^ Ball, W. W. Rouse; Coxeter, H. S. M. (1987). Mathematical Recreations and Essays. New York: Dover Publications. p. 59. ISBN 978-0-486-25357-2.
7. ^ Pietenpol, J. L.; A. V. Sylwester; Erwin Just; R. M Warten (February 1962). "Elementary Problems and Solutions: E 1473, Square Triangular Numbers". American Mathematical Monthly (Mathematical Association of America) 69 (2): 168–169. ISSN 0002-9890. JSTOR 2312558.
8. ^ Plouffe, Simon (August 1992). "1031 Generating Functions" (PDF). University of Quebec, Laboratoire de combinatoire et d'informatique mathématique. p. A.129. Retrieved 2009-05-11.