Determine if a number is the sum of two triangular numbers.
Solution 1:
The equation: $$ x(x+1)+y(y+1)=2z \tag{1}$$ is equivalent to: $$ (2x+1)^2 + (2y+1)^2 = 8z+2 \tag{2} $$ hence $z$ is the sum of two triangular numbers iff $8z+2$ is the sum of two squares, i.e. iff for every prime $p$ of the form $4k+3$ that divides $8z+2$, $\nu_p(8z+2)$ is even.
In the given example, $z=87180$, we have:
$$ 8z+2 = 2\cdot 17 \cdot 73\cdot 281 \tag{3}$$ and every odd prime occurring in the RHS of $(3)$ is of the form $4k+1$, hence $8z+2$ can be written as the sum of two odd squares: $$ 8z+2 = 101^2 + 829^2 \tag{4}$$ and $z$ is the sum of two triangular numbers: $$ 87180 = \binom{51}{2}+\binom{415}{2}.\tag{5} $$
Solution 2:
If we had $a(k)$ from A008441 the test for $z$ would be $$ a(z) > 0 . $$
The information section on this series provides many interesting relations.