# 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!

• For what exactly are you solving? Nov 20, 2021 at 23:34
• Show your work for what you get when following the hints you were given. Nov 21, 2021 at 0:12
• $2n$ or $2^n{}$? Nov 21, 2021 at 0:17
• $2^n$, sorry, i edited it now. Nov 21, 2021 at 0:26

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).$$

Full proof that there is only one solution $$m=1, p=3, n=6$$. $$2^n\mod 7$$ is $$1,2,4,1...$$ as $$n=0,1,2,3,...$$, $$m^3\mod 7$$ is $$0,1,-1$$. So $$m^3\mod 7 =2^n\mod 7$$ implies $$n=3k$$, $$m\equiv 1, 2, 4\mod 7$$. So you have $$7p^2=2^{3k}-m^3=(2^k-m)(2^{2k}+2^km+m^2)$$. Since $$m^3<2^{3k}$$, $$m<2^k$$. So $$2^k-m$$ is a positive divisor of $$7p^2$$, whence $$2^k-m=1,7,p, 7p, p^2$$ or $$7p^2$$, and, resp. $$2^{2k}+2^km+m^2=7p^2, p^2, 7p, p, 7$$ or $$1$$. The last option is not possible. If $$2^k=m+1$$, then $$(m+1)^2+(m+1)m+m^2=3m^2+3m+1=7p^2$$, so $$m\equiv 1\mod 7$$, $$m=7s+1$$ ($$m\equiv 2, 4$$ are impossible since $$m$$ is odd). Hence $$147s^2+63s+7=7p^2$$ or $$21s^2+9s+1=p^2$$. So $$(p-1)(p+1)=3s(7s+3)$$. Or $$=3(2^k-2)/7(2^k+1)$$. Note that $$(p-1)(p+1)$$ is divisible by $$4$$. The only way $$3(2^k-2)/7(2^k+1)$$ is divisible by $$4$$ is $$k=1$$. Then $$m=1$$ which gives $$7p^2=7, p=1$$, impossible.

If $$2^k-m=p$$, then $$(m+p)^2+(m+p)m+m^2=3m^2+3mp+p^2=7p$$. So $$p<7$$ and you can check $$p=2,3,5$$. If $$p=2$$, $$7p^2=28$$, $$2^{k}-m=2$$, $$3m^2+6m+4=14$$, no integer solution. If $$p=3$$, then $$3m^2+9m+9=21$$, $$m^2+3m-4=0$$, $$m=-4, 1$$. Only $$m=1$$ works, $$k=2$$. So $$n=6$$. Check $$2^6-(1)^3=63=9*7=3^2*7$$. So $$m=1, n=6$$ works.

Finally, $$p=5$$, then $$3m^2+15m+25=35$$, $$3m^2+15m-10=0$$, no solution.

Similarly consider the cases $$2^k-m=7, 7p, p^2$$. For example if $$2^k=m+7p$$ then $$(m+7p)^2+m(m+7p)+m^2=p$$ which is impossible. Same for $$2^k-m=p^2$$.

The case $$2^k-m=7$$ gives $$(m+7)^2+(m+7)m+m^2=p^2$$, $$3m^2+21m+49=p^2$$. Modulo $$7$$, $$m^2=0,1,4,2$$, then the LHS $$\equiv 0, 5, -1$$ which can be $$=p^2\equiv 0,4,2$$ only if $$p\equiv 0 \mod 7$$, so $$p=7$$ being a prime. Hence $$m=0$$ or $$m=-7$$ but that contradicts the assumption that $$m+7$$ is a power of $$2$$.

• Sorry, I don't get the part of if $2^k=m+1$. Isn't that just assuming one case? Nov 21, 2021 at 2:07
• Yes, you consider the cases $2^k=m+1, m+7, m+p, m+7p, m+p^2$. The first one is the longest. Nov 21, 2021 at 2:09
• @markvs: Are there no solution? Nov 21, 2021 at 4:43
• @Piquito: Yes, I have updated the answer. Nov 21, 2021 at 4:50
• @markvs: Dear friend, you have to edit your answer because there are solutions. The problem is basically to find positive integer points of an elliptic curve with the aditional difficulty of one of them prime, so if you don't have a trick of modular arithmetic the problem is essentially hard. But, believe me please, your "Full proof that there are no solutions" should be deleted because is wrong. Nov 21, 2021 at 13:10