Number theory question about powers Find all solutions in positive integers to the following equation where p is a prime number:
$m^3 + 7p^2 = 2^n$
I tried doing it mod $7$, and then using difference of cubes, but now I am stuck. Can anyone help me?
I was given a hint:
Consider both sides of the given equation modulo $7$. That is, consider what the possible
remainders could be for perfect cubes are when divided by $7$. Do the same for powers of $2$. This
should allow you to deduce something about $n$. After this, rewrite the equation as $7p^2 = 2^n - m^3$
and see if you can factor the right hand side. Note that since p is prime, there aren’t too many ways
of factoring $7p^2$.
I followed the hint, and got $7p^2=(2^k-m)(2^{2k}+2^km+m^2)$, which I split into three cases, $(1,7p^2),(7,p^2),(p,7p)$.
Thank you!
 A: COMMENT.- Modulo $7$ we have $m\ne0$ so $m^6\equiv1\pmod7$ Fermat's little theorem) then  $m^3=\pm1\pmod7$ and because modulo $7$ we have $2^n=1,2\text{ or } 4$ we concluded that  the cases $2$ and $4$ must be eliminated that our equation must be (noting $3n$ instead of $n$)$$m^3+7p^2=2^{3n}\iff7p^2=(2^n-m)(2^{2n}+2^2m+m^2)$$
Since $2^n-m\lt2^{2n}+2^2m+m^2$ we must have $2^n-m=1,7\text { or } p$ (the case $2^n-m=p^2$ is discarded because it leads easily to $p=1$). Consequently we have to solve the three systems of two equations:
$$2^n-m=1\text { and } 4^n+2^nm+m^2=7p^2\hspace2cm(1)\\2^n-m=7\text { and } 4^n+2^nm+m^2=p^2\hspace2cm(2)\\2^n-m=p\text { and } 4^n+2^nm+m^2=7p\hspace2cm(3)$$ from which $(3)$ gives easily the solution $\color{red}{(m,p,n)=(1,3,6)}$ corresponding in $(3)$ to the values $n=2$ and $(p,m)=(3,1)$.
On the other hand the three equations above have infinitely many integer solutions among them it could be another solution maybe (if not at all it could be maybe proved by some trick of modular arithmetic but in fact we have essentially a problem concerning elliptic curves which are frequently very hard). I leave here this COMMENT mentioning that, for example, the system $(1)$ has the integer solutions (we ommited the solutions for $m$.
$$p=\frac{1}{28}\big((14+3\sqrt{21})(55-12\sqrt{21})^k-(14-3\sqrt{21})(55+12\sqrt{21})^k\big)$$ in which the value $k=2$ give the prime $p=109$ (the other integer corresponding to $m$ for the same exponent $k=2$ should be confronted the the proposed equation to verifiy if this gives a power of $2^3, etc, etc).$
