When triangular number is the square of an elementary formula is obtained. Sam got a couple of pieces, but I wonder how the formula looks opisyvayushaya sum of two triangular numbers is the square of an integer.
$X(X+1)+Y(Y+1)=Z^2$
So we have to find solutions to this Diophantine equation.
For example in the equation: $X(X+1)+Y(Y+1)=Z^2$
If we use the solutions of Pell's equation: $p^2-2k(k-a)s^2=1$
Then the solution can be written, where the numbers $"a,k"$ whole and sets us.
$X=aps+(2k^2-ak-a^2)s^2$
$Y=-aps+(2k^2-3ak)s^2$
$Z=(2k-a)ps+a^2s^2$
More.
$X=-2p^2+(4k-3a)ps-(2k^2-3ak+a^2)s^2$
$Y=-2p^2+(4k-a)ps-(2k^2-ak)s^2$
$Z=2p^2-3(2k-a)ps+(4k^2-4ak+a^2)s^2$