Find all $x,y$ be positive integers,such $$12^x-5^y=19$$

I found $(x,y)=(2,3)$ is solution,maybe have other,so I consider case $x,y>3$ and $\pmod 9$,since $$12^x\equiv 0\pmod 9,x\ge 2$$

then $5^y\equiv -1\pmod 9$,

$5^1\equiv 5 \pmod 9$

$5^2\equiv 7 \pmod 9$

$5^3\equiv 8 \pmod 9$

$5^4\equiv 4 \pmod 9$

$5^5\equiv 2 \pmod 9$

$5^6\equiv 1 \mod 9\Rightarrow y\equiv 3 \mod 6\Rightarrow y$ is odd.

  • $\begingroup$ If you want to eventually prove that there are no other solutions, working mod $9$ will not be enough. You need to work mod $27$ (or mod $8$) because that distinguishes the known solution with $x=2$ from $x\ge 3$. $\endgroup$ Commented Mar 31, 2022 at 5:12

2 Answers 2


To show that there are no solutions with $x \ge 3$, let's consider the equation modulo $27$. When $x\ge 3$, the equation becomes $-5^y \equiv 19 \pmod{27}$, or $5^y \equiv 8 \pmod{27}$. This calculation is intimidating, but rewarding: $5$ has multiplicative order $18$ modulo $27$, and so we are able to conclude $y \equiv 15 \pmod{18}$. In particular, $y \equiv 6 \pmod 9$.

To make use of this, we look at the factors of $5^9-1$: two reasonably-sized ones are $19$ and $31$. We want factors of $5^9-1$ because when $d \mid 5^9-1$, knowing that $y \equiv 6 \pmod 9$ tells us that $5^y \equiv 5^6 \pmod d$.

  • Taking the equation mod $19$, we get $12^x - 5^6 \equiv 0 \pmod{19}$, or $12^x \equiv 7 \pmod{19}$. This is true when $x \equiv 4 \pmod 6$.
  • Taking the equation mod $31$, we get $12^x - 5^6 \equiv 19 \pmod{31}$, or $12^x \equiv 20 \pmod{31}$. This is true when $x \equiv 2 \pmod {30}$.

But these two contradict each other, so there are no solutions (with the assumption $x\ge3$ we started from).

We could also have combined the last two steps into a calculation modulo $19\cdot31 = 589$, where $12^x - 5^6 \equiv 19 \pmod{589}$ has no solutions.


Although @MishaLavrov has already provided a solution, I'll show here a pretty mechanical (and general!) method how to detect, that a second solution for $$ 12^x - 5^y = 19 \tag 1$$ beyond $(x,y)=(2,3)$ cannot exist. 1)

We find easily that $19 = 144 - 125 = 12^2-5^3$. Thus we have indeed $$ 12^x - 5^y = 12^2-5^3 \tag 2 $$ This can be reformulated into $$ 12^x-12^2 = 5^y-5^3 $$ $\qquad$ and then $${12^u-1 \over 5^3 } = {5^v-1 \over 12^2} \tag 3 $$ $\qquad \qquad $ Here we want, that $(u=x-2,v=y-3) \gt (0,0)$.

In the lhs, the numerator to have the primefactor $5$ to the power of $3$ we must have $u = 4 \cdot 5^2$ or a multiple of this, so we could introduce this restriction on $u$ $$ {12^{4 \cdot 5^2 \cdot u_1}-1 \over 5^3 } = {5^v-1 \over 12^2} \tag {4a} $$ In the rhs we can determine a restriction for $v$ analoguously: to have the primefactors $12^2=2^4 \cdot 3^2$ in the numerator, we must have that $v=2^2 \cdot 3$ or a multiple of this, so we introduce this restriction as well: $$\underset{\text{lhs}}{\underbrace{ {12^{4 \cdot 5^2 \cdot u_1}-1 \over 5^3 } }} =\underset{\text{rhs}}{\underbrace{ {5^{2^2 \cdot 3 \cdot v_1}-1 \over 12^2} }} \tag {4b} $$ Now, if $u_1=1$ and $v_1=1$ have their minimal values, we have in the lhs and the rhs the following primefactor-decompositions: $$ \begin{array} {ll} \text{lhs}:& & 13\;\; .\text{<big>} \\ \text{rhs}:& & 13\;\; .7.31.601 \end{array} \tag 5$$ The difference between the primefactorization of the lhs and of the rhs must now be compensated by expanding the exponents $u_1$ and $v_1$ appropriately to get equality.

But before we start to do this (possibly iteratively) we would look, how an unsolvable contradiction for the equation between lhs and rhs could possibly occur: if the involved adaption of exponents/primefactors includes either, that the lhs get one more primefactor of $5$ such that it becomes to be divisible by $5^4$ instead of $5^3$ - or that the rhs is forced to include exponents in $v_1$ such that the (composite) factor $12$ occurs to the third power instead of second power (or simply the primefactor $2$ to the $5$'th power or the primefactor $3$ to the third power which would already suffice for an "unsolvability contradiction").

To make it short, we find in the lhs in (4b) (resp. (5)) the primefactor $p=1201$. Thus we must expand the exponent in the rhs such that it shall occur as well there. For this, we must expand the exponent to include the "multiplicative order" $\pmod 5$ of $p=1201$ which is $o_5=600$. If we include this value $o_5$ into the exponent in the rhs we get the primefactorization

$$\begin{array} {} \Large \text{rhs}&=& \Large {5^{\text{lcm} (2^2 \cdot 3, 600)}-1 \over 12^2} \\ &=& \quad 2 \quad . \\ &&.251.313.401.521.601.\quad 1201 \quad.1741.1901.\text{<big>} \end{array} \tag 6$$ We have thus indeed adapted the rhs to contain the primefactor $1201$.

But, as a sideeffect, we have also one more primefactor $2$, and this makes the whole rhs being even.

This expresses contradiction, or condition of impossibility: the lhs can never be even (except both lhs & rhs are zero), so because the primefactor $p=1201$ is unavoidedly in the lhs, it must as well be in the rhs, and if it is in the rhs, then as a "collateral effect" the rhs moreover becomes even, which the lhs cannot be.

So this is enough to prove there is no additional solution beyond $(x,y)=(2,3)$.

1)The principle of this method has been applied several times already here in MSE at least by Will Jagy and by myself, perhaps later I can add some links.


You must log in to answer this question.

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