TITLE: How prove this diophantine equation $x^2+y^2+z^3=n$ always have integer solution
QUESTION [14 upvotes]: show that: For any postive ineteger $n$,then the equation 
  $$n=x^2+y^2+z^3$$
  always have integer solution

My idea: such as $n=1$,then we have
$$1=0^2+0^2+1^3$$
$$2=0^2+1^2+1^3$$
$$3=1^2+1^2+1^3$$
$$4=2^2+0^2+0^3$$
$$5=1^2+2^2+0^3$$
$$6=1^2+2^2+1^3$$
$$7=2^2+2^2+(-1)^3$$
$$8=0^2+0^2+2^3$$
$$9=1^2+0^2+2^3$$
$$10=1^2+1^2+2^3$$
$\cdots\cdots\cdots$
But for  general $n$, How prove it?

REPLY [4 votes]: Here’s a proof using a solution I found here. 
Write $n$ in the form $8^m\cdot s$, for an integer $m\ge0$ and with $s$ not divisible by $8$. This can always be done. Note that an integer $s$ that is not a multiple of $8$ can be written in one of the following three forms: $2k+1$ (if $s$ is odd), $4k+2$ (if $s$ is even, but not a multiple of $4$), or $8k+4$ (if $s$ is even and a multiple of $4$).
First, find an expression for $s$ in the form $a^2+b^2+c^3$ as follows. (I haven’t checked these details.)
If $s=2k+1$, let $a=k^2-k-1$, $b=k^3-3k^2+k$, and $c=-k^2+2k$.
If $s=4k+2$, let $a=2k^3-2k^2-k$, $b=2k^3-4k^2-k+1$, and $c=-2k^2+2k+1$
If $s=8k+4$, let $a=k^2-2k-1$, $b=k^3+k+2$, and $c=-k^2-1$
Now observe that if $s$ is the sum of two squares and a cube, so is $8s$, because $8(a^2+b^2+c^3)=(2a+2b)^2+(2a-2b)^2+(2c)^3$. Inductively, if $s$ is the sum of two squares and a cube, then so is $8^ms$ for any nonnegative integer $m$.
We have already shown that $s$ is the sum of two squares and a cube, so $n=8^ms$ is as well, completing the proof.