TITLE: Integer solutions of $n^3 = p^2 - p - 1$
QUESTION [9 upvotes]: Find all integer solutions of the equation, $n^3 = p^2 - p - 1$,  where p is prime.

REPLY [2 votes]: Rewrite the expression as $p(p-1)=(n+1)(n^2-n+1)$. Case 1: $p|n+1$. It follows that $p\leq n+1$. But then also $p-1 \geq n^2-n+1$, and from these we get $n \geq n^2-n+1$ which can only be true for $n=1$ which gives $p=2$.
Case 2: $p|n^2-n+1$. We write $\frac{n^2-n+1}{p}=k$. Plugging this into the equation we get $p=kn+k+1$. Return to the definition of $k$ and plug this in. We get $n^2-n+1=k(kn+k+1)$ which translates to the quadratic equation
$$n^2+n(-1-k^2)+(1-k-k^2)=0$$
Since these are all integers, the discriminant must be a perfect square, that is
$$(k^2+1)^2-4(1-k-k^2)=(k^2+3)^2+4k-12$$
It is trivial to conclude that this cannot be a square greater than $(k^2+3)^2$ so we can only have $k=3$. Which gives us $n=11,p=37$.
Therefore, the only solutions are $(n,p)\in \{(1,2),(11,37)\}$.