What are the pairs ($p,n$) of non-negative integers where $p$ is a prime number, such that $$p^2+n-3=6^n+n^6$$

How can I solve this diophantine equation?


Assume $p\neq 3$. Then $p^2\equiv 1\pmod 3$.

  • If $3\mid n$, $n\neq 0$, then $1\equiv 0\pmod {3}$, impossible.
  • If $n=0$, then $(p,n)=(2,0)$ is a solution.
  • If $3\nmid n$, then $n^6\equiv 1\pmod {3}$ and so $1+(1\text{ or }2)\equiv 1\pmod {3}$, impossible.

If $p=3$, then LHS ($n+6$) is smaller than RHS ($6^n+n^6$) $\forall n\ge 2$ and not equal for $n=0$, but equal when $n=1$. So $(p,n)=(3,1)$ is another solution.


If $n \equiv 0,1\pmod3$, we have $3$ divides $6^n+n^6 - n+3$, except for $n=0$. Further, for $n=1$, we have $6^n+n^6 - n+3 = 9 = 3^2$. Hence, $n \equiv 2\pmod3$. However, if $n \equiv 2 \pmod3$, we have $$6^n+n^6 - n+3 \equiv 2\pmod3$$ and no square is $2 \pmod 3$. Hence, the solutions are $(n,p) = (0,2)$ and $(n,p) = (1,3)$.

  • $\begingroup$ $3\mid 6^n+n^6-n+3$ doesn't automatically mean it is impossible - $p$ can be $3$, and indeed $(p,n)=(3,1)$ is another solution. $\endgroup$ – user26486 Apr 5 '15 at 22:23
  • $\begingroup$ @user31415 OK. The small cases can be fixed though. What is important is the main idea. Anyway, I have fixed it now. $\endgroup$ – Leg Apr 9 '15 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.