Solving $5^x - 2^x = 117$ using modular arithmetic I'm trying to solve $5^x - 2^x = 117$. The solution is very easy to find by inspection, however I'm having difficulty trying to find reasoning specifically using modular arithmetic where the solution pops up naturally (i.e. not having to guess).
My work so far has been:
$5^x - 2^x\,$ is strictly increasing and positive only for $x>0$ so the original equation must only have $1$ solution. Assuming there exists an integer solution, the following holds true:
$$\begin{align*}5^x-2^x &= 117\\5^x-125&=2^x-8\\125(5^{x-3}-1)&=8(2^{x-3}-1)\end{align*}$$
This tells us $2^{x-3}-1$ has to be a multiple of $125$, so $$2^{x-3}\equiv1\mod125$$Since $\text{ord}_{125}(2)=100$, $x-3 = 100k\,$ for some $k\in\Bbb N$. Similarly, $5^{x-3}-1$ has to be a multiple of $8$, and $\text{ord}_{8}(5)=2$, so $x-3 = 2m \,$ for some $m \in\Bbb N$. The first equation already encapsulates the second one so $x=100k+3$.
This is where I'm stuck. Any help towards reaching the $x=3$ solution using modular arithmetic would be very much appreciated.
 A: Modular arithmetic cannot provide a bound to the solution, so you must develop one independently.
If $x$ is a positive integer, then $2^x\le(2/5)(5^x)$ and thus
$(3/5)(5^x)\le117.$
So $5^x\le195$, meaning a positive integer solution cannot be greater than $3$.
It is then sufficient to solve the equation only using $\bmod 5$. Thus we find
$0-2^x\equiv2$
$2^x\equiv3\equiv8$
whose only solution within the bound $x\le3$ is $x=3$.
A: we may also allow separate exponents for $2,5,$ Very similar to what you did, there is a certain amount of factoring to find useful primes, in this problem we need add   just $41$  to the list $2,5,41.$
To begin with $$ 5^u - 125 = 2^v -8$$
As you also used, make new exponents $x,y$ so that
$$  125 \left( 5^x -1  \right)  =  8 \left( 2^y - 1 \right)  $$
With the guess that we already know the largest possible $u,v:$ ASSUME   that both $x,y \geq 1 $ in the above.
To reduce the size of the numbers, we point out: as $2^y - 1 \equiv 0 \pmod 5,$  we know already that $4|x.$  Just a little more, from  $2^y - 1 \equiv 0 \pmod {25},$  we find that $20|x.$
This is enough to go on:  $$ 2^{20} - 1 |  2^y - 1 $$   and
$$   2^{20} - 1 =  3 \cdot 5^2 \cdot 11 \cdot 31 \cdot  41 . $$
Thus $41 |  2^y-1.$  This forces $41 |  5^x - 1 ,$   therefore $20 | x.$
We don't need that much. It is enough to use $4|x.$  Because
$$   5^4 - 1 =  2^4 \cdot 3 \cdot 13  $$ That is, $5^x-1$ is divisible by $16;$  we reach the needed contradiction from $$  16 | 8  \left( 2^y - 1 \right).  $$ It cannot be true unless $y=0.$
