<s>[INST] the cube of integer can be written as the difference of two square This Exercise $4$, page 7, from Burton's book Elementary Number Theory.
Prove that the cube of any integer can be written as the difference of two squares. [Hint: Notice that $n^{3}=(1^{3}+2^{3}+\cdots+n^{3})-(1^{3}+2^{3}+\cdots+(n-1)^{3}).$]
Is there a way to prove that in a more natural way?
I would appreciate your help.
 [/INST] A more natural approach is to work out exactly which integers can be written as the difference of two squares, and then notice that all cubes are such.
So suppose $n=a^2-b^2$, with $n$, $a$ and $b$ all integers. Then we have $n=(a+b)(a-b)$. Setting $x=a+b$, $y=a-b$ we have $n=xy$ with $a=\frac{x+y}{2}$, $b=\frac{x-y}{2}$. Since $a$ and $b$ are integers, $x$ and $y$ must be of the same parity.
Thus if $n$ is a different of two squares, then it can be factorized into two integers of the same parity. Either the factors are both odd, in which case $n$ is odd, or the factors are both even, in which case $n$ is divisible by $4$. Conversely, if $n$ is odd then $n=1\cdot n=\left (\frac{n+1}{2}\right)^2-\left(\frac{n-1}{2}\right)^2$, while if $n$ is divisible by $4$ then $n=2\cdot \frac{n}{2}=\left (\frac{n+4}{4}\right)^2-\left (\frac{n-4}{4}\right)^2$.
So the integers which are a difference of two squares are precisely those which are either odd or a multiple of $4$ (in other words, those not congruent to $2$ mod $4$). Since the cube of an odd number is odd and the cube of an even number is divisible by $2^3=8$ and hence by $4$, every cube is a difference of two squares.
</s>