A sequence based on Catalan–Mihăilescu problem It was conjectured by Catalan in 1844 that the only solutions of the equation $x^a-y^b=1$ over variables $a,b,x,y\in\mathbb{N^+}$ are trivial ones: $3^1-2^1=1$ and $3^2-2^3=1$. The conjecture was proved true by Preda Mihăilescu in 2002.
Let's consider the equation $3^a-2^b=n$  over variables $a,b\in\mathbb{N^+}$ with a parameter $n\in\mathbb{N^+}$. Let $f(n)$ be the number of solutions of this equation for a given $n$.


*

*Is there a simple way to calculate $f(n)$ for a given $n$?

*Can $f(n)$ take any values except $0$ and $1$ for $n>1$?

*Is it possible that $f(n)=\infty$?

*Are there arbitrary long runs of $0$'s and $1$'s in the sequence?

*What is the asymptotic density of $0$'s in the sequence?

 A: 
Can $f(n)$ take any values except $0$ and $1$ for $n>1$?

Yes, $2^5 - 3^3 = 5 = 2^3 - 3^1$, but this is very exceptional!  

Is it possible that $f(n)=\infty$?

No. Indeed, $f(n)$ is $0$ or $1$ for $n\gt 13$  (and for the remaining ones all solutions are also known and I think there are never more than two, but deifinitely only very small, see link below). This was proved by Stroeker and Tijdeman (1982) however that it is only $0,1$ for large $c$ is a lot older (Herschfeld in the thirties).

Are there arbitrary long runs of $0$'s and $1$'s in the sequence?

For $0$ yes, for $1$ I am not sure at the moment but I doubt it (and it might be known, perhaps there is even a direct argument).

What is the asymptotic density of $0$'s in the sequence?

The density is $1$. This follows from the fact that the number of solutions $(x,y)$ of the diophantine inequality
$$ 0 \lt  2^x - 3^y \le c$$ is asymptotically $(\log c )^2/ (2 \log 2 \log 3)$.
So below $c$ the function $f$ can be (and is, due to above mentioned result) positive only about  $(\log c)^2$ times. (This is a special case of a result by Pillai.)
For further details the start of the paper of Waldschmidt "Perfect powers: Pillai's works and their devellopment" is a good starting point. Also you might look at http://oeis.org/A219551 which gives (something equivalent to) the exact values of $f(n)$ and some references (but note this is slightly different as absolute values are considered).
A: The conjecture that there is at most a single solution to the equation $3^a-2^b=n$, provided $|n|>13$ (which implies that $f(n)$ is $0$ or $1$ for $n > 1$), dates back to Pillai and was proved by Stroeker and Tijdeman in 1982 (using lower bounds for linear forms in logarithms). One has (again, from linear forms in logarithms) inequalities of the shape
$$
\left| 3^a - 2^b \right| > 2^{0.9b},
$$
by way of example, valid for something like $b > 3$. This enables one to compute $f(n)$ efficiently and to show that the asymptotic density of zeros in the sequence of values of $f(n)$ is one. If you assume that $a$ and $b$ are positive, $3^a-2^b$ is odd and so there are never consecutive occurrences of $f(n)=1$.
