Solving $4^m-3^n=p^2$ for natural $(m,n,p)$.

I know that such exponential equations, like the one in question, $4^m-3^n=p^2$ (where $m,n,p$ are natural) are usually solved using numerical methods, so I tried the following.

My attempt

I’ve split the search into parts; at least intuitively (and WolframAlpha confirms), the only solutions are $(0,0,0)$ and $(1,1,1)$. So, I’ve shown that these are the solutions for $m,n\le 2$ by direct calculation. Then, I analysed the last digits of the square difference in each case, first noting that:

$$l(4^k)=\begin{cases} 4, 2\mid k\\ 6, 2\nmid k \end{cases}$$

And that:

$$l(3^k)=\begin{cases} 3, k\equiv 1\: (\text{mod }4)\\ 9, k\equiv 2\: (\text{mod }4)\\ 7, k\equiv 3\: (\text{mod }4)\\ 1, 4\mid k \end{cases}$$

Where $l$ is the last-digit function. For $2\mid m$ and $n\equiv 1 \text{ or } 2\: (\text{mod }4)$ and for $2\nmid m$ and $k \equiv 3 \text{ or } 0\: (\text{mod }4)$, the last digits are $3$ or $7$, so $p$ cannot be a natural number.

However, I am not sure how I should go about the other $4$ cases. Any hints on how to continue with this proof, or does anybody know a simpler / nicer approach?

Setting aside $4^0-3^0=0^2$ and $4^1-3^1=1^2$, we see we need $m\ge2$, in which case $-3^n\equiv p^2$ mod $8$ is enough to conclude there are no other solutions, since $-3^n\in\{5,7\}$ mod $8$, while $p^2\in\{0,1,4\}$.

Hint: Write like this

$$(2^m-p)(2^m+p) =3^n$$

Solution:

So $2^m-p = 3^a$ and $2^m+p = 3^b$ for some $a,b$ where $a+b=n$ and $b\geq a\geq 0$.

Now

$$2^{m+1}= 3^b+3^a = 3^a(3^{b-a}+1)\implies a=0 \;\;\;{\rm and}\;\;\; 2^{m+1}= 3^b+1$$

so $$(-1)^{m+1}\equiv_3 1 \implies m+1=2k$$

so $$(2^k-1)(2^k+1)=3^b$$ and we can repeat story $2^k-1 =3^x$ and $2^k+1=3^y$ for some $x,y$ where $x+y=k$ and $y\geq x\geq 0$.

So $$2 =3^y-3^x = 3^x(3^{y-x}-1)\implies x=0 \;\;\;{\rm and}\;\;\;3^y=3\implies y=1$$

So $k=1$ and $m=1$. So $n=1$ and $p= 1$.

If $0$ is also natural number then for $b=0$ we have $n=0$ and $m=0$ and $p=0$.

• Thanks for your hint. But how come $n=2$ and $m=2$ satisfy the requirements? $4^2-3^2=7$, which is definitely not a perfect square. – Mr. Xcoder May 24 '18 at 13:24
• Should it be $2p=3^b-1$? – Cameron Williams May 24 '18 at 13:25
• $(-1)^{m+1}\equiv_3 1$ only holds if $b>0$ You miss the case $b=0$. – sharding4 May 24 '18 at 13:50
• Since $b= n$ and $n$ natural we have $b>0$. – Aqua May 24 '18 at 13:53

rewriting $$2^{2m} - p^2 = 3^n \\ (2^m - p)(2^m+p) = 3^n \\$$ shows that each parenthese can only have the factors $1$ and $3$ because their product is a perfect power of $3$ . So we have $$2^m - p = 3^a \\ 2^m + p = 3^b$$ Their sum is $$2 \cdot 2^m = 3^a(1+3^{b'})$$ and we have the factor $3^a$ but which must be $3^a=1$ Moreover, $(1+3^{b'})$ must also be a perfect power of $2$ which is only possiblefor $b'=0$ and $b'=1$
By this we have
$2 \cdot 2^m = 1 \cdot(1+3^0)=2 \to m=0$ or
$2 \cdot 2^m = 1 \cdot(1+3^1)=4 \to m=1$

• Upps, this answer crossed with that of @ChristianF while editing... – Gottfried Helms May 24 '18 at 13:56