Proof that $26$ is the one and only number between square and cube

Solution 1:

Instead write $$x^2+2=y^3$$ so that $x^2+2=(x+\sqrt{-2})(x-\sqrt{-2})$ is a norm from the integer ring $\Bbb Z[\sqrt{-2}]$ which is Euclidean. So then it is clear that $\gcd(x+\sqrt{-2},x-\sqrt{-2})\mid\sqrt{-2}$, so that if $\sqrt{-2}\nmid x$ they are coprime. Since $x$ is an integer, this means their $\gcd$ is $\sqrt{-2}$ iff $x$ is even and 1 otherwise.

Case 1: $\sqrt{-2}\mid x$ whence $x=2m$ so that we have $x^2+2=4m^2+2=2(m^2+1)$ so $2\mid y$ and $m=2k+1$ necessarily. But then $x^2+2=4(k^2+k+1)$ and $k^2+k+1$ is always odd $\bmod 4$, a contradiction since $8\mid y^3$. Hence $x$ is odd which puts us in

Case 2: $\gcd(x+\sqrt{-2},x-\sqrt{-2})=1$

Then $x+\sqrt{-2}=(a+b\sqrt{-2})^3$ and here's the kicker:

$$(a+b\sqrt{-2})^3=a^3+3a^2b\sqrt{-2}-6ab^2-2b^3\sqrt{-2} = (a^3-6ab^2)+(3a^2b-2b^3)\sqrt{-2}.$$

Now since $3a^2b-2b^3=b(3a^2-2b^2)=1$ it must be that $b=\pm 1$ and similarly $3a^2-2b^2=\pm 1$. Since $b^2=1$ this means $3a^2=2\pm 1$ clearly $3a^2=1$ is impossible, so $a=\pm 1$ gives us our only solutions.

So $x=a^3-6a=a(-5)$ the only positive possibility is $x=5$, which immediately gives $y=3$.

Solution 2:

The equation $y^2 = x^3 - 2$ defines an elliptic curve, and it's known that such a curve has only finitely many integer solutions. I don't think there's a simple way of actually finding all of those solutions, though, at least in the general case. There are algorithmic solutions, but nothing that's easily done by hand.

This paper covers a few instances of the Mordell curve $y^2 = x^3 + k$ using elementary methods, and it specifically includes the case $y^2= x^3 - 2$ you mentioned. The technique depends crucially on the ring of integers in $\mathbb{Q}(\sqrt{k})$ being a unique factorization domain, though, which is not the case in general. It is true for $\mathbb{Q}(\sqrt{-2})$, though, so it turns out to be straightforward (though it does involve a bit of computation).