Solve $3^m-2=n^2$ for positive pairs of integers $(n,m)$.

My try:

$3^m-6=n^2-4\implies 3(3^{m-1}-2)=(n+2)(n-2)\implies 3=n+2\ or\ 3=n-2$ so we got $n=\pm 5 , \pm 1$. Used $\pm$ as we have $n^2$.

Putting $n=\pm 5 , \pm 1$ gives $m=3,1$ respectively. We kick out negative ones as problem ask for positive ones only.

But how do I prove that $n+2=3$ not something like multiples of $3$ and similar for $n-2$. More precisely something like the following:

$n+2=3d$, $n-2=k$ and $dk=3^{m-1}-2$.

Please help.


Solution 1:

This is too long for a comment. My approach is not "elementary" since I use factorization in quadratic rings, more exactly, I'll work in $\Bbb{Z}[\sqrt{-2}]$ which is known to be a Euclidean domain and hence a UFD (unique factorization domain). Moreover, in this ring every element $x+y\sqrt{-2}$ has norm $N(x+y\sqrt{-2})=(x+y\sqrt{-2})(x-y\sqrt{-2})=x^2+2y^2$.

If $m$ is even, then we would have a difference of two squares equal to $2$, but it's easy to see that in that case there are no solutions.

Then $m$ is odd. If $m=1$ we have $3-2=n^2$ which give us $n=1$. So from now on we assume that $m\ge 3$. We rewrite the equation in the following form $$3^m=n^2+2=(n+\sqrt{-2})(n-\sqrt{-2}).$$

We claim that $n+\sqrt{-2}$ and $n-\sqrt{-2}$ are coprime. Indeed, if $d=\gcd(n+\sqrt{-2},n-\sqrt{-2})$, then $d\mid (n+\sqrt{-2})-(n-\sqrt{-2})=2\sqrt{-2}$, so $N(d)\mid N(2\sqrt{-2})=8$. On the other hand, $d\mid n+\sqrt{-2}$, which implies that $N(d)\mid N(n+\sqrt{-2})=n^2+2=3^m$ and therefore we deduce that $N(d)$ is an odd positive divisor of $8$, hence it must be $N(d)=1$ and this implies that $d$ is an unit in $\Bbb{Z}[\sqrt{-2}]$.

Since $n+\sqrt{-2}$ and $n-\sqrt{-2}$ are coprime and its product is a $m$-th power, by the fundamental theorem of the arithmetic in $\Bbb{Z}[\sqrt{-2}]$ we can conclude that there are units $u, v\in \Bbb{Z}[\sqrt{-2}]$ and elements $a_1\pm b_1\sqrt{-2}\in \Bbb{Z}[\sqrt{-2}]$ such that $$n+\sqrt{-2}=u(a_1+b_1\sqrt{-2})^m,$$ $$n-\sqrt{-2}=v(a_1-b_1\sqrt{-2})^m.$$

But, it's known that the units of $\Bbb{Z}[\sqrt{-2}]$ are $1$ and $-1$, both being $m$-th powers (indeed, $1^m=1$ and $(-1)^m=-1$), thus we can assume that both $n+\sqrt{-2}$ and $n-\sqrt{-2}$ are pure $m$-th powers, i.e., $$n+\sqrt{-2}=(a+b\sqrt{-2})^m,$$ $$n-\sqrt{-2}=(a-b\sqrt{-2})^m.$$

Now, we have $(a+b\sqrt{-2})^m(a-b\sqrt{-2})^m=(n+\sqrt{-2})(n-\sqrt{-2})=n^2+2=3^m$, then $$((a+b\sqrt{-2})(a-b\sqrt{-2}))^m=(a^2+2b^2)^m=3^m.$$

Therefore we deduce that $a^2+2b^2=3$, which has the solutions $a=\pm 1$ and $b=\pm 1$. Let's suppose initially that both $a$ and $b$ are positive, i.e., $a=b=1$. This lead us to $$n+\sqrt{-2}=(1+\sqrt{-2})^m.$$

Comparing the imaginary parts of both expressions in last equation gives us $$1=\sum_{k=0}^{\frac{m-1}{2}}(-2)^k \binom{m}{2k+1}.$$

I'm stuck here because the RHS alternates positive with negative values and I don't know how that expression can be bounded. Besides we can't try to use a $p$-adic argument similar to the solution of the equation $x^m-1=y^2$ because we can't remove $1$ from the LHS.

Solution 2:

If $m=3k$, then the equation is $n^2 = (3^k)^3 -2$. I put the elliptic curve $y^2=x^3-2$ into SAGE. The only integral point is $(x,y) = (3,5)$ which corresponds to the the solution $m=3, n=5$.

If $m=3k+1$, then multiply through by $9$ to get $(3n)^2 = (3^{k+1})^3 - 18.$ I put the curve $y^2 = x^3-18$ into SAGE. The only integral point is $(x,y) = (3,3)$, which corresponds to the solution $m=1, n=1$.

If $m=3k+2$, then multiply through by $81$ to get $(9n)^2 = (3^{k+2})^3 - 182.$ I put the curve $y^2 = x^3 - 182$ into SAGE and there are no integral points.

So there are only the two solutions to the equation. I don't see a more elementary way to do this.