Are There Infinitely Many Square Triangular Numbers? Toying around with triangular numbers, it seems that there are
already 4 squares below 1000. At least I get this one:
?- between(1,1000,N), T is N*(N+1)//2, sqrtrem(T,_,0).
N = 1,
T = 1 ;
N = 8,
T = 36 ;
N = 49,
T = 1225 ;
N = 288,
T = 41616 ;
No

Are there infinitely many square triangular numbers?

To reproduce work
done many times before.
If
$T_n = m^2$,
since
$T_n = \dfrac{n(n+1)}{2}$,
this becomes
$n(n+1) = 2m^2$.
Completing the square,
$n^2+n+\frac14
=2m^2+\frac14
$
or
$(n+\frac12)^2
=2m^2+\frac14
$.
Clearing fractions,
this is
$(2n+1)^2
=8m^2+1
$
or
$(2n+1)^2-8m^2
=1
$.
This is a case
of a Pell equation
$x^2-dy^2 = 1$,
and the identity
$\begin{array}\\
(x^2-dy^2)(u^2-dv^2)
&=x^2u^2-d(x^2v^2+y^2u^2)+d^2y^2v^2\\
&=x^2u^2\pm 2dxuyv+d^2y^2v^2-d(x^2v^2\pm 2xuyv+y^2u^2)\\
&=(xu\pm dvy)^2-d(xv\pm yu)^2\\
\end{array}
$
shows that if there is one solution to
$x^2-dy^2 = 1$
then there are
an infinite number.
If $(x_0, y_0)$
satisfies
$x_0^2-dy_0^2 = 1$,
the recurrence is
$x_{n+1} = x_0x_n+dy_0y_n,
y_{n+1}=x_0y_n+y_0x_n
$.
If $d=8$,
since
$3^2-8\cdot 1^2 = 1$,
the recurrence is
$x_{n+1} = 3x_n+8y_n,
y_{n+1}=3y_n+x_n
$.
Starting with
$(x_0, y_0) =(3, 1)$,
and remembering that
the $n$ in $T_n$
satisfies $2n+1 = x$,
this gives
$
(x_1, y_1)
=(3\cdot 3+8\cdot 1, 3\cdot 1+3)
=(17, 6)
\quad (\dfrac{8\cdot 9}{2} = 6^2)\\
(x_2, y_2)
=(3\cdot 17+8\cdot 6, 3\cdot 6+17)
=(99, 25)
\quad (\dfrac{49\cdot 50}{2} = 25^2)\\
$
