I stumbled upon this simple-sounding problem:
Consider pairs $(n, p)$, where $n$ is a natural number $(0, 1, 2, 3...)$ and $p$ is a prime number. Find all $(n_i, p_i)$ pairs that satisfy $$p(p-1) = 2(n^3 + 1)$$
Find the sum of satisfying pairs: $\sum\limits_i (n_i + p_i)$
While I was able to figure out one of the solutions ($n=0$, $p=2$), I wrongly assumed that it was the only pair. Just to test it I wrote a simple python bruteforce script which gave me another solution: $n=20$, $p=127$, and I cannot figure out how to get that. Any ideas?
If I rearrange the terms I get $$2n^3 = (p+1)(p-2),$$ but that doesn't tell me much aside from the fact that the right-hand-side expression is even. The other way I tried approaching it is by solving quadratic equation $$p^2 -p - 2(n^3+1)$$ wrt to $p$ which gives me that $\sqrt{8n^3 + 9}$ should be a square number (that's how I actually got my first solution for $n=0$). But how to figure out the either $p=127$ or $n=20$?
Okay, with a lot of help from a few friends I managed to find the missing solution.
The rhs can be expanded as $2(n+1)(n^2-n+1)$. On the lhs we have $p(p-1)$. Since $p$ is a prime, either $n+1$ or $n^2-n+1$ can be expressed as $K\cdot p$. But $n$ has to be less than $p$ therefore it's $pK = n^2-n+1$. Substituting and dividing by $p$: $$p-1 = 2(n+1)K \rightarrow p = 1 + 2(n+1)K;$$ I can now multiply both parts by $K$ and substitute back $pK = n^2 - n + 1$: $$n^2-n+1 = 2(n+1)K^2 + K.$$ This will give me an equation $$n^2 - (1+2K^2)n + 4(2K^2+K-1)=0.$$ Solving it wrt $n$ gives me an expression for $K$ which then needs to be a square and I can find $K$ and in turn $n$ and $p$, since $p=2(n+1)K + 1$