A few days ago I asked for a solution for $3^a+1=2^b$ where $a\in \Bbb N$ and $b\in \Bbb N$ (Solutions for diophantine equation $3^a+1=2^b$), and I got two good answers for this question.

But there I also asked for the more general case $p_1^a+n=p_2^b$ where $p_1$ and $p_2$ are prime and $a,b,n\in \Bbb N$. But this part of my question was ignored, so here I explicitly asks for ways to find solutions for this general case.

I still am interested in any $p_1$ and $p_2$, but im very focused on $p_1=3$ and $p_2=2$ because this is part of another problem that I try to solve.

I explicitly am interested in solutions for this equations:

  • $3^a+5=2^b$
  • $3^a+7=2^b$
  • $3^a+13=2^b$
  • $3^a+23=2^b$
  • ...

where $a\in \Bbb N$ and $b\in \Bbb N$ and where $b>2$ ($2^b>4$)

Supposed that $b>2$, you can show, that in

$2^b-3^a \equiv n \pmod{24}$

$n$ only can be $5,7,13$ or $23$

$2^b \pmod{8}$ is always $0$ when $b>2$; $3^a \pmod{8}$ is always $1$ or $3$; so $2^b-3^a \pmod{8}$ only can be $5$ or $7$. $3^a \pmod{3}$ is always $0$ when $a>0$, but $2^b \pmod{3}$ is never $0$, it's either $1$ or $2$, so also $2^b-3^a \pmod{3}$ only can be $1$ or $2$. Together this leads to the fact, that $2^b-3^a \pmod{24}$ only can be $5,7,13$ or $23$ when $b>2$.

Knowing this, I was searching for differences $n$ of powers of $2$ minus powers of $3$ having $n<100$ and I found this:

  • $n=5$:
    $3^1+5=2^3 \rightarrow 3+5=8$
    $3^3+5=2^5 \rightarrow 27+5=32$

  • $n=7$:
    $3^2+7=2^4 \rightarrow 9+7=16$

  • $n=13$:
    $3^1+13=2^4 \rightarrow 3+13=16$
    $3^5+13=2^8 \rightarrow 243+13=265$

  • $n=23$:
    $3^2+23=2^5 \rightarrow 9+23=32$

  • $n=29 = 5+24$:
    $3^1+29=2^5 \rightarrow 3+29=32$

  • $n=31 = 7+24$:
    no solution found

  • $n=37 = 13+24$:
    $3^3+37=2^6 \rightarrow 27+37=64$

  • $n=47 = 23+24$:
    $3^4+47=2^7 \rightarrow 81+47=128$

  • $n=53 = 5+2*24$:
    no solution found

  • $n=55 = 7+2*24$:
    $3^2+55=2^6 \rightarrow 9+55=64$

  • $n=61 = 13+2*24$:
    $3^1+61=2^6 \rightarrow 3+61=64$

  • $n=71,77,79,85,95$:
    no solutions found

By comparing any power of 2 up to a certain limit (which was $b \le 2^{10}$) with the biggest powers of 3 being smaller than that power of 2, I found out, that all other differences of powers of 2 minus powers of 3 are bigger than 100 for all $b \le 2^{10}$ which means $2^b \le 1.8 \times 10^{307}$.

So the solutions for $n<100$ listed above are the only existing solutions with $3^a$ and $2^b$ having less than 307 decimal digits. And this makes me believe, that there also are no solutions for $n=5,7,13,23,31,...,95$ when $3^a$ and $2^b$ are bigger than $10^{307}$.

And I also think, that there is no difference, that appears infinitely often. I even think, that the maximum number that a given difference can appear is 2.

But I have no idea how to prove this.
Can you help?

  • Are there any other solutions for low values of $n$? If yes: How can you find them? If no: How can you prove that?
  • How many values for $a$ (or $b$) can share the same difference $n$?
  • 3
    $\begingroup$ One can devise a systematic method of finding all the solutions, since explicit lower bounds on $|2^a-3^b|$ can be given. See here $\endgroup$
    – Wojowu
    Commented Dec 24, 2016 at 14:51
  • $\begingroup$ @Wojowu: Thanks a lot! This article is very interesting. $\endgroup$ Commented Dec 24, 2016 at 15:22
  • 1
    $\begingroup$ I've found an article of Michael Bennett on the work of S. Pillai ( "Pillai's conjecture revisited" ). There are theorems which state that for $p_1=3,p_2=2$ or vice versa there is always at most only one solution for one specific difference (formulated as $|(n+1)^a - n^b|=d$ except for a very small list having 6 entries if $n=2$. So one can stop large quests for possible repeated solutions... (Also I've tried myself to solve the general case for $(p_1,p_2) = (3,2)$ with elementary means but am not yet sure whether my attempt allows also a general proof) $\endgroup$ Commented Dec 24, 2016 at 20:46
  • $\begingroup$ @GottfriedHelms: I read your profile. My native language is German (but I'm not German like you, I am from Austria). Maths is a hobby for me (as it is for you) and I came to this power of 2/3-thing via the Collatz Conjecture. So we seem to have something in common. But I have a problem: When I read English books about mathematics, I don't understand some basic terms just because they are named different in German. So please can you help me? Where can I find a book about number theory, that uses German and English terms? $\endgroup$ Commented Dec 24, 2016 at 22:08
  • $\begingroup$ Hubert, hi! - ganz mein Problem. Meine Tochter, eine 1+-englische, findet mein mathematisches Englisch ziemlich kauderwelschig, und ich habe in vieler HInsicht ähnliche Schwierigkeiten, komplexere englische Texte zu verstehen, geschweige selbst zu schreiben... ;-) Die Diskussionen in meiner eigentlichen deutschen "Heimat"-Newsgroup haben vor Jahren repide nachgelassen so daß ich mich wohl-oder-übel zu meinem half-baked Englisch gezwungen sehe (aber man hat ja dadurch auch ein größeres Publikum). Kann leider im Moment keine spezielle Buchempfehlung machen - aber mal sehen... $\endgroup$ Commented Dec 24, 2016 at 23:55

1 Answer 1


CW answer, too long for comment. A student introduced an elementary method which is pretty good when the numbers do not get too large.

Exponential Diophantine equation $7^y + 2 = 3^x$

Elementary solution of exponential Diophantine equation $2^x - 3^y = 7$.

Elementary solution of exponential Diophantine equation $2^x - 3^y = 7$.

Finding solutions to the diophantine equation $7^a=3^b+100$

I should add that @Gottfried Helms


came up with a variation that has successfully handled some problems with bigger numbers; from the point of view of my answers, "big" means the size of the pair of primes that are used.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .