First, I was wondering what would the solution(s) be to the equation $3^x-2^y=17$ such that $x$ and $y$ are both positive integers. I couldn't find any small possibilities. Is there a proof that such a solution exists? How about the general case $3^x-2^y=z$? Is there exactly one x and y positive integer solution for every positive integer z (not divisible by 2 or 3 that is)? Thanks in advance!

  • 2
    $\begingroup$ Try $x = 3, y = 4$... $\endgroup$
    – taninamdar
    Jan 25, 2016 at 22:02
  • $\begingroup$ Oops, editing now. Should read 17 not 11. Sorry. =( $\endgroup$ Jan 25, 2016 at 22:09
  • $\begingroup$ For that, try $x = 4, y = 6$. Though small cases are easy, I think this problem is hard in general. $\endgroup$
    – taninamdar
    Jan 25, 2016 at 22:11
  • $\begingroup$ Awesome! Thanks! I feel really dumb... Is there a proof that for every $3^x-2^y=z$ there exists an x, y, and z in the positive integers? $\endgroup$ Jan 25, 2016 at 23:12
  • $\begingroup$ At least I don't know any proof in general. But I believe there is a theorem when the difference is $1$. Also there are no solutions when the difference is an even number. $\endgroup$
    – taninamdar
    Jan 25, 2016 at 23:15

3 Answers 3


It is not true that there is a solution for every odd $z$ not divisible by $3$. For example, $3^x-2^y=13$ is impossible. For we can check by hand that there is no solution if $y=1$ or $y=2$. And if $y\ge 3$, then $13+2^y\equiv 5\pmod{8}$. But powers of $3$ are congruent to $1$ or $3$ modulo $8$. There are infinitely many examples of this type.

We can give a partial answer to your question about the uniqueness of the solution, if there is one. It is a theorem of Stroeker and Tijdeman that the equation $3^x-2^y=z$ has at most one solution in positive integers if $|z|\gt 13$.

For more information, and references, please see OEIS.

  • $\begingroup$ Awesome! That's the one I was struggling with earlier! Not 11 or 17. =\ So if I understand you right, $2^y$ such that $y>2$ will always be equivalent to 0 (mod 8) as it'll be a multiple of 8. 13 is equivalent to 5 (mod 8). Since $3^x$ can never be equivalent to 5 (mod 8), then there's no x,y solution for $z=13$. I think I got it! Thanks! $\endgroup$ Jan 26, 2016 at 0:40
  • $\begingroup$ You are welcome. Yes, you have got it. Exponential Diophantine equations can be very difficult. But, on occasion, relatively straightforward congruence arguments settle things. $\endgroup$ Jan 26, 2016 at 0:44

So the constant is $17$ instead of $11$. Well, working in the field $\mathbb F_{17}$ one has the equation $$3^x=2^y$$ Noticing now that in this field, $\color{green}{2=3^{14}}$ and $\color{green}{3^{16k}=1}$ it follows the equivalent equation (in $\mathbb F_{17}$) $$3^x=3^{14y} \equiv 3^{x+16k}=3^{14y}$$ It follows (in $\mathbb Z$ now) $$x+16k=14y \quad (*)$$ The equation $(*)$ has an infinity of integer solutions $(x,y,k)$ nevertheless it is clear that not all of them fit in the equation $3^x-2^y=17$.

We use the theorem of Stroeker and Tijdeman quoted by @Andre Nicolas according to which if we find a solution or we prove there is none, we finished (my will has weakened with 11 previously put in place of 17).

We find easily $(x,y,k)=(4,6,5)$ as a fitting solution. Thus $$\color{red}{3^4-2^6=17}$$ shows the only solution.


Because we know, that there is one solution possible $$ 3^4-2^6 = 17 \\$$ we rewrite the problem a bit: $$ 3^{x+4} - 2^{y+6} \overset?= 17 = 3^4-2^6 \qquad \qquad \text{with } x,y \gt 0 \tag 1$$ and reformulate for readability $$ {3^{x} - 1 \over 2^6} \overset?={2^{y}-1 \over3^4 } \qquad \qquad \text{with } x,y \gt 0\tag 2 $$ First, to get the numerators containing the denominators as factors their exponents must have the following structure: $$ {3^{2^4 x_1} - 1 \over 2^6} ={2^{2 \cdot 3^3 \cdot y_1}-1 \over3^4 } \qquad \qquad \text{ where } 2 \not \mid x_1 \text{ and } 3 \not \mid y_1 \tag 3 $$

Now let's assume $x_1 = y_1 = 1$. We get the primefactors for the lhs as $$ {3^{2^4 x_1} - 1 \over 2^6} = \tag{ lhs} $$ and for the rhs as $${2^{2 \cdot 3^3 \cdot y_1}-1 \over3^4 } = 7.19.73.\text{<big>} \tag { rhs} $$ So far the lhs and rhs have no common factor and thus can trivially not be equal.

We can now try iteratively to adapt the exponents such that either the both sides have at some iteration the same primefactorization and are thus equal or that we arrive at an impossibility and thus at a contradiction.

For instance, to make the rhs containing the primefactor $193$ the exponent must contain the order of $193$ to base $2$, such that $193 \mid \text{ <rhs> }$ . This requires that in the exponent we have the value $96 = 2^5 \cdot3$ and we can write $${2^{2^5 \cdot 3^3 \cdot y_2}-1 \over 3^4 } = 193.\quad\text{<big>} \tag { rhs} $$ and so indeed the rhs contains now the primefactor $193$. But this introduced a lot of additional primefactors, which must now occur in the lhs, too.

Let's look at the primefactor $257$. To get it in the lhs we need in the exponent of the lhs the value $2^8$. But this contradicts the restriction in $(3)$ where we find that $2 \not \mid x_1$ and we need now $2^4 \mid x_1$ to allow the primefactor $257$ to appear.

Thus we have a contradiction, and we can state:

Theorem: There is no second solution besides $x=y=0$ in $(3)$ and thus not in (1)


You must log in to answer this question.

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