# Square 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 infinitely many square triangular numbers; the first few are 0, 1, 36, 1225, 41616, 1413721, 48024900, 1631432881, 55420693056, 1882672131025 (sequence A001110 in the 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

${\displaystyle N_{k}=s_{k}^{2}={\frac {t_{k}(t_{k}+1)}{2}}.}$

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

${\displaystyle 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

{\displaystyle {\begin{aligned}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{aligned}}}

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

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

and

${\displaystyle 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

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

With a bit of algebra this becomes

${\displaystyle (2t+1)^{2}=8s^{2}+1,}$

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

${\displaystyle 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]

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

and therefore all solutions are given by

${\displaystyle 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)

${\displaystyle N_{k}=34N_{k-1}-N_{k-2}+2,{\text{ with }}N_{0}=0{\text{ and }}N_{1}=1.}$
${\displaystyle 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

${\displaystyle s_{k}=6s_{k-1}-s_{k-2},{\text{ with }}s_{0}=0{\text{ and }}s_{1}=1;}$
${\displaystyle 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

${\displaystyle {\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 ${\displaystyle 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, ${\displaystyle 49=7^{2}=2*5^{2}-1,288=17^{2}-1=2*12^{2}}$, and ${\displaystyle 1681=41^{2}=2*29^{2}-1.}$ In each case, the two square roots involved multiply to give ${\displaystyle s_{k}:5*7=35,12*17=204,}$ and ${\displaystyle 29*41=1189.}$[citation needed]

${\displaystyle N_{k}-N_{k-1}=s_{2k-1}:36-1=35,1225-36=1189,}$ and ${\displaystyle 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]

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

## Numerical data

As ${\displaystyle k}$ becomes larger, the ratio ${\displaystyle t_{k}/s_{k}}$ approaches ${\displaystyle {\sqrt {2}}\approx 1.41421356}$ and the ratio of successive square triangular numbers approaches ${\displaystyle (1+{\sqrt {2}})^{4}=17+12{\sqrt {2}}\approx 33.970562748}$. The table below shows values of ${\displaystyle k}$ between 0 and 11, which comprehend all square triangular numbers up to ${\displaystyle 100\,000\,000}$.

${\displaystyle k}$ ${\displaystyle N_{k}}$ ${\displaystyle s_{k}}$ ${\displaystyle t_{k}}$ ${\displaystyle t_{k}/s_{k}}$ ${\displaystyle N_{k}/N_{k-1}}$
${\displaystyle 0}$ ${\displaystyle 0}$ ${\displaystyle 0}$ ${\displaystyle 0}$
${\displaystyle 1}$ ${\displaystyle 1}$ ${\displaystyle 1}$ ${\displaystyle 1}$ ${\displaystyle 1.00000000}$
${\displaystyle 2}$ ${\displaystyle 36}$ ${\displaystyle 6}$ ${\displaystyle 8}$ ${\displaystyle 1.33333333}$ ${\displaystyle 36.000000000}$
${\displaystyle 3}$ ${\displaystyle 1\,225}$ ${\displaystyle 35}$ ${\displaystyle 49}$ ${\displaystyle 1.40000000}$ ${\displaystyle 34.027777778}$
${\displaystyle 4}$ ${\displaystyle 41\,616}$ ${\displaystyle 204}$ ${\displaystyle 288}$ ${\displaystyle 1.41176471}$ ${\displaystyle 33.972244898}$
${\displaystyle 5}$ ${\displaystyle 1\,413\,721}$ ${\displaystyle 1\,189}$ ${\displaystyle 1\,681}$ ${\displaystyle 1.41379310}$ ${\displaystyle 33.970612265}$
${\displaystyle 6}$ ${\displaystyle 48\,024\,900}$ ${\displaystyle 6\,930}$ ${\displaystyle 9\,800}$ ${\displaystyle 1.41414141}$ ${\displaystyle 33.970564206}$
${\displaystyle 7}$ ${\displaystyle 1\,631\,432\,881}$ ${\displaystyle 40\,391}$ ${\displaystyle 57\,121}$ ${\displaystyle 1.41420118}$ ${\displaystyle 33.970562791}$
${\displaystyle 8}$ ${\displaystyle 55\,420\,693\,056}$ ${\displaystyle 235\,416}$ ${\displaystyle 332\,928}$ ${\displaystyle 1.41421144}$ ${\displaystyle 33.970562750}$
${\displaystyle 9}$ ${\displaystyle 1\,882\,672\,131\,025}$ ${\displaystyle 1\,372\,105}$ ${\displaystyle 1\,940\,449}$ ${\displaystyle 1.41421320}$ ${\displaystyle 33.970562749}$
${\displaystyle 10}$ ${\displaystyle 63\,955\,431\,761\,796}$ ${\displaystyle 7\,997\,214}$ ${\displaystyle 11\,309\,768}$ ${\displaystyle 1.41421350}$ ${\displaystyle 33.970562748}$
${\displaystyle 11}$ ${\displaystyle 2\,172\,602\,007\,770\,041}$ ${\displaystyle 46\,611\,179}$ ${\displaystyle 65\,918\,161}$ ${\displaystyle 1.41421355}$ ${\displaystyle 33.970562748}$

• Cannonball problem on numbers that are simultaneously square and square pyramidal
• Sixth power, numbers that are simultaneously square and cubical

## 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)". Mémoires de l'Académie des Sciences de St.-Pétersbourg (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. ^ Weisstein, Eric W. "Square Triangular Number". MathWorld.
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. doi:10.2307/2312558. 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.