Solve $x^3+2x+1=2^n$ over positive integers? I just have proved that $x^3+2x+1$ can not be divided by $2^n$ ($n>3$), for $x=8k+t$ and $t=0,1,2,3,4,6,7$, but for $x=8k+5$, I have no way to deal with this case, may someone give me some hints for this question? It seems that $(x,n)=(1,2)$ is the unique solution. Also what I know is that $x$ must divide $2^n-1$.
Note. Here both  $x$ and $n$ are positive integers.
 A: Use the Quadratic Reciprocity - https://en.wikipedia.org/wiki/Quadratic_reciprocity (The supplementary laws using Legendre symbols):
\begin{align}
\left(\frac{-2}{p}\right) = (-1)^{\frac{p^2+4p-5}{8}}=\begin{cases}
1 & p\equiv 1,3~\text{(mod 8)}\\
-1 & p\equiv 5,7~\text{(mod 8)}
\end{cases}
\end{align}
\begin{align}
 {}
\end{align}
As you mentioned, for $n\ge 3$, we must have $x\equiv 5 ~~\text{(mod 8)}$. Now note that
\begin{align}
 x^3+2x+1 \equiv 1 ~~ \text{(mod 3)}.
\end{align}
You can directly check it by using Fermat's little theorem. Thus, we have \begin{align}
x^3+2x+1 = 2^n\equiv (-1)^n\equiv 1 ~~\text{(mod 3)},
\end{align}
which implies that $n$ is even. Let $n=2m$. By adding $2$ to both sides, we obtain
\begin{align}
(x+1)(x^2-x+3) = 2^{2m}+2.
\end{align}
Now consider $x^2-x+3$. Clearly, it is an odd number, and its prime factor $p$ must divide $(2^m)^2+2$. It then follows that $p=8k+1$ or $p=8k+3$ due to the quadratic reciprocity. This implies that
\begin{align}
  x^2-x+3 \equiv \text{1 or 3}~~\text{(mod 8)}.
\end{align}
However, because $x\equiv 5 ~~\text{(mod 8)}$, we have
\begin{align}
x^2-x+3 \equiv 25-5+3\equiv 7~~\text{(mod 8)},
\end{align}
which is a contradiction.
