# Solve $3^a-5^b=2$ for integers a and b.

So I have got that (a,b)=(1,0),(3,2) are solutions for the equations, and maybe the only one.

• If $b\ge 2$, $3^a\equiv 27\pmod{100}$, so $a\equiv 3\pmod {40}$. Nov 23, 2014 at 10:36
• @ajotatxe: $a\equiv3\pmod{20}$ to be more accurate. Nov 23, 2014 at 10:42
• For $a\le 5000,\ b\le 5000$, there are no more solutions. Nov 23, 2014 at 11:11
• Considering, how difficult it was to prove catalan's conjecture, it is probably very difficult to prove that there are no more solutions. Nov 23, 2014 at 11:20
• The least $j$ with $$5^j+2\equiv 0\ (\ mod\ 3^{11}\ )$$ is $70058$ Nov 23, 2014 at 11:42

We know that $b$ is even (since $2^b+2$ is divisible by 3). We also know that the only solution to $y^2+2=x^3$ is $y=5,x=3$. (Solving the diophantine equation $y^{2}=x^{3}-2$)
Thus it is sufficient to show that $a$ is divisible by 3. Suppose that $a \geq 2$. Since 9 divides $5^b+2$, we get that $b=6k+2=3m+2$. We have $25(125)^m+2=3^a$. We get $3^a$ is $27$ mod $31$ which forces $a$ to be $3$ mod $30$, in particular divisible by $3$.
• if ab=xy, and gcd(x,y)=gcd(a,b)=1 it doesn't mean that for example a has to be x or y, it can be a factor of one of those two or it can be the product of some factors of x and y. Like we have that $15\cdot 2=3\cdot 10$ Dec 6, 2014 at 15:37
• Also, the paper isibang.ac.in/~sury/x2+2=y%5En.pdf shows that this is the only solution to $x^2+2=y^n$. Dec 8, 2014 at 17:13
These are the only solutions modulo $$5^3 \cdot 601.$$ If you had a solution with $b \geq 3$ then we would require that $a \equiv 43$ modulo $100$. Modulo $601$ (there are lots of other choices), there are only $12$ choices for $5^b$. Solving $3^a \equiv 5^b+2 \mod{601}$ for each of these choices tells us that necessarily $a$ is congruent to $0, 1$ or $3$ modulo $75$, a contradiction.