<s>[INST] $|2^x-3^y|=1$ has only three natural pairs as solutions Consider the equation $$|2^x-3^y|=1$$ in the unknowns $x \in \mathbb{N}$ and $y \in \mathbb{N}$. Is it possible to prove that the only solutions are $(1,1)$, $(2,1)$ and $(3,2)$?
 [/INST] Case 1: If $2^x=3^y+1$ then $x \ge 1$. If $y=0$ then $x=1$.
If $y \ge 1$ then $3^y+1 \equiv 1 \pmod{3}$. Therefore $2^x \equiv 1 \pmod{3}$. Hence $x=2x_1$ with $x_1 \in \mathbb{N}^*$. The equation is equivalent to $$3^y= (2^{x_1}-1)(2^{x_1}+1)$$
Since $2^{x_1}+1>2^{x_1}-1$ and $\gcd (2^{x_1}-1,2^{x_1}+1) \ne 3$ then $2= 3^{m} (3^{n-m}-1)$ with $2^{x_1}-1=3^m,2^{x_1}+1=3^n$. Thus, $m=0,n=1$. We obtain $x_1=1$ or $x=2$. Thus, $y=1$.
Case 2. If $3^y=2^x+1$. If $x=0$ then there is no natural number $y$. If $x=1$ then $y=1$. If $x \ge 2$ then $3^y \equiv 1 \pmod{4}$. Thus, $y$ is even, let $y=2y_1$ with $y_1 \in \mathbb{N}^*$. The equation is equivalent to $$2^y=(3^{y_1}-1)(3^{y_1}+1)$$
Thus, $2=2^n(2^{m-n}-1)$ with $2^m=3^{y_1}+1,2^n=3^{y_1}-1$. It follows that $n=1,m=2$. Thus, $y_1=1$ or $y=2$. We get $x=3$.
The answer is $\boxed{ (x,y)=(1,0),(1,1),(2,1),(3,2)}$.
</s>