<s>[INST] Integer Solutions of the Equation $u^3 = r^2-s^2$ The question says the following:

Find all primitive Pythagorean Triangles $x^2+y^2 = z^2$ such that $x$ is a perfect cube.

The general solution for each variable are the following:
$$x=r^2-s^2$$
$$y=2rs$$
$$z=r^2+s^2$$
such that $\gcd(r,s) = 1$and $r+s \equiv 1 \pmod {2}$
In order to make $x$ a perfect cube, I shall have the equation $x=u^3=r^2-s^2$. However, I am stuck to find a general formula for such cubes. 
I know that a subset of the solutions might be the difference between two consecutive squares. This difference is always an odd integer. I can collect some examples such $14^2-13^2 = 27$ but I cannot give a formula for such type either.
Any ideas?
 [/INST] $u^3=(r+s)(r-s)$ and $\gcd(r+s,r-s)=1$, so $r+s$ and $r-s$ are odd, coprime perfect cubes.
So let $r+s=a^3$, $r-s=b^3$. Then 
$$r=\frac{a^3+b^3}2$$
$$s=\frac{a^3-b^3}2$$
where $a$ and $b$ are odd and coprime.
Conversely, if $a$ and $b$ are odd and coprime, let $r=(a^3+b^3)/2$ and $s=(a^3-b^3)/2$, which are coprime and have different parity. Indeed, 
$$r+s=a^3$$
which is odd and coprime with
$$r-s=b^3$$
</s>