# The sum of two triangular numbers.

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.

• What does "opisyvayushaya" mean? – user61527 Apr 14 '14 at 5:37
• Google badly translated. Mean formula in general terms. – individ Apr 14 '14 at 5:45
• The number $x(x+1)$ is not necessarily a triangular number. Triangular numbers are of the shape $x(x+1)/2$. – André Nicolas Apr 14 '14 at 5:47
• What's the difference? Let such a formula would be. Then move on to the next equation is not difficult. – individ Apr 14 '14 at 5:49
• We need to find all pairs of $X,Y$ such that ${X(X+1) \over 2} + {Y(Y+1) \over 2} = Z^2$ for a given $Z$. right? – nitish712 Apr 14 '14 at 6:12

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$

It is necessary then to just write another equation:

$\frac{X(X+1)}{2}+\frac{Y(Y+1)}{2}=Z^2$

If we use the solutions of Pell's equation: $p^2-(2k^2+a^2)s^2=1$

formula for the solution can be written, where $k,a$ integers asked us.

$X=p^2+(4k-a)ps+2k(2k-a)s^2$

$Y=-aps-a(2k-a)s^2$

$Z=p^2+(3k-a)ps+k(2k-a)s^2$

And more.

$X=aps+(2k^2-2ak-a^2)s^2$

$Y=-aps-a(2k-a)s^2$

$Z=(k-a)ps+a(k+a)s^2$

Interestingly, and if you add three triangular numbers, the formula would look like?