Find all integer solutions m,n such that ${3^m}-{7^n}=2$.

contest-mathelementary-number-theory

I came across this problem on artofproblemsolving.com. So far its been days and there has been no answer to this question:

Find all integer solutions m,n such that: $${3^m}-{7^n}=2$$

I tried using modular arithmetic and Fermat's little theorem on this with no yield. Any and all help is appreciated.

Best Answer

If $n=0$ then $m=1$. If $n\geq 1$ then $m\geq 2$ and $3^m-2\equiv 0 \pmod{7}$ iff $m=6k+2$. Moreover $7^n+2\equiv 9\equiv 9^{3k+1}\pmod{36}$ iff $n=6j+1$. Therefore it remains to solve $$3^{6k+2}-7^{6j+1}=2$$ that is $$9(3^{6k}-1)=7(7^{6j}-1)$$ We claim that $k=j=0$ is the only solution and therefore the given equation ${3^m}-{7^n}=2$ has just two solutions $(m,n)$: $(1,0)$ and $(2,1)$.

Assume that $k,j\geq 1$. Note that the prime $43$ divides $(7^6-1)$ and therefore it divides also the right-hand side. It follows that $7$ divides $k$. Then $7^2$ is a factor of $3^{42}-1$ which is a factor of the left-hand side. But then we have a contradiction: $7^2$ divides $7(7^{6j}-1)$ with $j\geq 1$.