[Math] If the difference of cubes of two consecutive integers is a square, then the square can be written as the sum of squares of two different integers.

number theory

How can i prove the statement that if the difference of cubes of two consecutive integers is an integral power of 2, then the integer with power 2 can be written as the sum of squares of two different integers.

For example:

$$8^3 – 7^3 = 13^2 = 12^2 + 5^2$$

Any help appreciated.

Thanks.

Best Answer

We can see that $$n^3-(n-1)^3=3n^2-3n+1.$$ By looking at congruences modulo 4, we see that $$n^3-(n-1)^3 \equiv 1\pmod 4.$$ Recalling that you assumed that the difference was a square, you can apply Fermat's theorem cited above to conclude.