How many answers to $|3^x-2^y|=5$?

There are only a finite number of solutions. It was proved by Pillai that $a^x - b^y = k$ where $a,b,k$ are fixed positive integers, $a > 1, b > 1, k \neq 0,$ with positive integer variables $x,y,$ has finitely many solutions. This is from page 51 in Shorey and Tijdeman, Exponential Diophantine Equations. The two papers by Pillai are 1931 and 1936. Both are in the Journal of the Indian Mathematical Society. A detail: if $k$ is larger than some bound that depends on $a,b,$ there is only one solution. Since we have more than one solution for $k = -5,$ it appears Pillai's bound is not tight enough to finish this problem. We just know one solution for $k=5.$


Here's an elementary self-contained argument that there is no solution with $y>5$.

A power of $3$ is congruent to either $1$ or $3 \bmod 8$, so once $y \geq 3$ we must have $3^x - 2^y = -5$.

Once $y \geq 6$, we then have $3^x \equiv -5 \bmod 2^6$, and thus $x \equiv 11 \bmod 16$.

But then $3^x + 5 \equiv 12 \bmod 17$, and no power of $2$ is congruent to $12 \bmod 17$ (the powers of $2 \bmod 17$ are $2,4,8,-1,-2,-4,-8,1,2,4,8,-1$ etc.), QED.


Adapting from my answer to Question 537010:

There is a large literature on such Diophantine questions. One key phrase is "$S$-unit equations". In general it has been known for some time that there are finitely many solutions, and indeed for equations of the form $$\prod_i p_i^{n_i} - \prod_j q_j^{m_j} = r$$ this already follows from Thue's theorem (1909); and by now we even have effective algorithms known to find all solutions. There's still no elementary technique known in general, but in your case (where only the primes 2,3,5) appear an elementary solution is contained in a 1976 paper

L. J. Alex: Diophantine equations related to finite groups, Communications in Algebra 4 #1 (1976), 77-100 (MR54:12634).

[My answer to 537010 cited David Rusin's known-math article on S-units, but the site is no longer supported by math.niu.edu and I can't find it elsewhere.]