TITLE: Solve $2^n=k^2+k+2$ for positive integers
QUESTION [6 upvotes]: This problem came from my own research ( research for fun, not professional ). I was able to simplify a little and solve some special cases, but I need a help to get the general case which is
"Find all pairs $(n,k)$ of positive integers such that $2^n=k^2+k+2$."
Thank you.
PS: It will be enough to consider $n$ odd.

REPLY [2 votes]: Reporting on my findings. Let's work in the ring $O=\mathbb{Z}[(-1+\sqrt{-7})/2]$ of
the field $\mathbb{Q}(\sqrt{-7})$. This field is of interest here, because
$$
k^2+k+2=(k-u_1)(k-u_2),
$$
where $u_1=(-1+\sqrt{-7})/2$ and $u_2=(-1-\sqrt{-7})/2$. 
The prime $2$ splits in $O$ into a product of two principale ideals, one generated by $u_1$ the other by $u_2$. The only units in this ring are $\pm1$. As $u_1u_2=2$ the equation can be written as
$$
u_1^nu_2^n=(k-u_1)(k-u_2).
$$
Because $(k-u_1)-(k-u_2)=\sqrt{-7}$ the ideals generated by $(k-u_1)$ and $(k-u_2)$ are coprime (they only have prime factors lying above $2$). Therefore we can conclude that
$$
k-u_1=\pm u_1^n
$$
or
$$
k-u_2=\pm u_1^n.
$$
It is very difficult for either of these equations to produce a rational integer $k$ as the answer. For that to happen either $u_1^n\pm u_1$ or $u_1^n\pm u_2$ has
to be real. In other words the imaginary part of $u_1^n$ has to be $\pm\sqrt7/2.$
We have, indeed,
$$
\begin{aligned}
u_1^2&=\frac{-3-i\sqrt7}2\\
u_1^3&=\frac{5-i\sqrt7}2\\
u_1^5&=\frac{-11-i\sqrt7}2\\
u_1^{13}&=\frac{181-i\sqrt7}2
\end{aligned}
$$
accounting for the solutions found by OP.
It takes more than a bit of luck to get such small imaginary parts in the power $u_1^n$. As $|u_1|=\sqrt2$ we have $|u_1^n|=2^{n/2}$. Therefore for success the argument $n\phi$ has to be very close to an integer multiple of $\pi$. Here $\phi=\arg u_1=\pi-\arctan\sqrt7$, and we see that $13\phi/\pi\approx 7.99535$.
I checked the fractional parts (rounded to closest integer) of $n\phi/\pi$ up to $n=2000$. Smaller distances do occur but for so large values of $n$ that the imaginary parts are still huge.