Number theory question about powers

elementary-number-theory

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!

Best Answer

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

Related Question