Primes as a difference of powers Find the smallest prime that cannot be written as
$$|3^a - 2^b|$$   
EDIT: I forgot to mention that $a$ and $b$ are whole numbers.

I tried to expand $3^a$ as $(2+1)^a$ using binomial theorem but I couldn't infer much. Please help. Thanks in advance!


$2$.  The second subtrahend is always $0~ (\text{mod}~ 2)$ and the first never is, so their difference can never be $\pm2$.
Conveniently, there are no smaller primes to check.
If on the other hand, $a$ and $b$ can be zero, then you break your problem into eight Pell equations and solve the set sequentially over primes until you find a prime that can't be solved in your desired form.  The Pell equations are: \begin{align}
x^2 - y^2 &= p  \\
-(x^2 - y^2) &= p \\
3x^2 - y^2 &= p \\
-(3x^2 - y^2) &= p \\
x^2 - 2y^2 &= p \\
-(x^2 - 2y^2) &= p \\
3x^2 - 2y^2 &= p \\
-(3x^2 - 2y^2) &= p 
\end{align}  This set of Pell equations comes from considering the exponents to be even or odd.  If an exponent is odd, extract one power of $2$ or $3$ as a coefficient and the remaining exponent is even.  Things with even exponents are squares.  For each prime, $p$, see if any of these Pell equations are solvable with $x$ a power of $3$ and $y$ a power of $2$.  If not, you have found your solution.
\begin{align}
2 &: &3 \cdot 1^2 - 1^2 = &|3^1 - 2^0| = 2 \\
3 &: &-(1^2 - 2^2) = &|3^0 - 2^2| = 3 \\
5 &: &               &|3^2 - 2^2| = 5 \\
  &  &               &|3^1 - 2^3| = 5 \\
7 &: & -(3^2 - 4^2) = &|3^2 - 2^4| = 7 \\
  &  & 3^2 - 2 \cdot 1^2 = &|3^2 - 2^1| = 7 \\
  &  & -(1^2-2 \cdot 2^2) = &|3^0 - 2^3| = 7 \\
\vdots \\
37&: & -(3\cdot 3^2 - 8^2) = &|3^3-2^6| = 37 \\
41&: & \text{no solutions}
\end{align}
and we find 41 is the first prime with no solution to any of these Pell equations of the desired form.  (It has solutions to the Pell equations where not both $x$ is a power of 3 and $y$ is a power of 2, so not of the desired form.)
