I read a puzzle about finding a natural number that is preceded by a perfect square and followed by a perfect cube. The answer was $26$, which is preceded by $25=5^2$ and followed by $27=3^3$. Are there any more numbers satisfying this property?

I have checked using python the first million natural numbers and there are none within that range.

Edit: I have found an answer in the site. I have edited the title for the following alternative question.

What about the reversed property: a number $n$ such that $n-1$ is a perfect cube and $n+1$ is a perfect square? In this case I haven't found any number at all.


1 Answer 1


For the first question, $n - 1 = y^2$ and $n+1 = x^3$, so $n = y^2 + 1 = x^3 - 1$, so $y^2 = x^3 - 2$. Fermat famously challenged British mathematicians to explain why the only solution in positive integers is $(x,y) = (3,5)$. Its solutions in integers are $(x,y) = (3,\pm 5)$ and one way to show that uses properties of the ring $\mathbf Z[\sqrt{-2}]$ (namely, that it has unique factorization and its only units are $\pm 1$). This ring gets involved by rewriting $y^2 = x^3 - 2$ as $x^3 = y^2 + 2 = (y+\sqrt{-2})(y-\sqrt{-2})$. You put a link to this approach in an edit to your post.

For the second question, $n - 1 = x^3$ and $n+1 = y^2$, so $n = x^3 + 1 = y^2 - 1$, so $y^2 = x^3 + 2$. Rewrite this as $x^3 = y^2 - 2 = (y+\sqrt{2})(y-\sqrt{2})$ in $\mathbf Z[\sqrt{2}]$, which is a PID (it is Euclidean). Show $x$ and $y$ are odd and, using that condition, show $y+\sqrt{2}$ and $y-\sqrt{2}$ are relatively prime in $\mathbf Z[\sqrt{2}]$. Therefore since their product is a cube, each is a cube up to unit multiple, so $$ y+\sqrt{2} = (a+b\sqrt{2})^3u $$ for some unit $u \in \mathbf Z[\sqrt{2}]$. On the right side, unit cubes can be absorbed into $(a+b\sqrt{2})^3$, so we only need to use as $u$ representatives of the units modulo cubes of units. It turns out that the units of $\mathbf Z[\sqrt{2}]$ are $\pm(1+\sqrt{2})^{\mathbf Z}$, so representatives for the units modulo unit cubes are $1, 1+\sqrt{2}$, and $(1+\sqrt{2})^{-1} = -(1-\sqrt{2})$. We can ignore the factor $-1$ since it's a unit cube, so we're reduced to three equations: $$ y+\sqrt{2} = (a+b\sqrt{2})^3, $$ $$ y+\sqrt{2} = (a+b\sqrt{2})^3(1+\sqrt{2}), $$ $$ y+\sqrt{2} = (a+b\sqrt{2})^3(1-\sqrt{2}). $$

The first equation, after equating coefficients of $\sqrt{2}$ on both sides, implies $$ 1 = 3a^2b + 2b^3 = b(3a^2 + 2b^2). $$ Therefore $b$ has to be $\pm 1$, but neither choice leads to an integer for $a$. So we get no solutions this way to the original equation.

The second equation, after equating coefficients of $\sqrt{2}$ on both sides, implies $$ 1 = a^3 + 3a^2b + 6ab^2 + 2b^3. $$ It turns out that the only integral solution to this is $(a,b) = (1,0)$, but that is not easy! (I don't have a reference for you off the top of my head -- google "cubic Thue equations".) Using this fact, $y+\sqrt{2} = (a+b\sqrt{2})^3(1+\sqrt{2}) = 1+\sqrt{2}$. so $y = 1$ and $x^3 = y^2- 2 = -1$. Thus $(x,y)= (-1,1)$.

The third equation, after equating coefficients of $\sqrt{2}$ on both sides, implies $$ 1 = (-a)^3 + 3(-a)^2b + 6(-a)b^2 + 2b^3, $$ which is the same as the previous equation with $-a$ in place of $a$. Therefore $(a,b) = (-1,0)$, which leads to $y = -1$ and then $x^3 = y^2 - 2 = -1$, so $(x,y) = (-1,-1)$.

In summary, if we accept that the only solution of $1 = a^3 + 3a^2b + 6ab^2 + 2b^3$ in $\mathbf Z$ is $(a,b) = (1,0)$ then the above argument shows the integral solutions of $y^2 = x^3 + 2$ are $(x,y) = (-1,\pm 1)$.

One lesson from this is that when $y^2 = x^3 + k$ really has integral solutions and you want to prove that you found all of them, the case when $k > 0$ is typically more difficult than the case when $k < 0$.

  • $\begingroup$ Do you have a proof or link to a proof of the second statement? $\endgroup$
    – Javi
    Commented May 15, 2022 at 14:38
  • 1
    $\begingroup$ I added some more details for the second statement, but not a full argument. It is a genuinely more subtle issue than solving $y^2 = x^3 - 2$ in $\mathbf Z$. $\endgroup$
    – KCd
    Commented May 15, 2022 at 22:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .