Find all natural numbers $n$ less than $100$ such that $n^{122} – 96n^{81}$ ends in the digits $77$.
To do this problem, I first tried using Fermat's little theorem, where $n^{7-1} ≡ 1\pmod 7$, but in the real problem, I only got up to the part where $122 ≡ 3\pmod 7$, and $81 ≡ 4\pmod 7$, but subtracting these do not give anything related to the last digits ending in $77$, so I am a bit stuck. I also do not know how to incorporate the $96$ in front of the $n^{81}$ into the modulus calculation.
Any help is appreciated $:)$
Best Answer
My method involves using modular arithmetic.
Numbers end in $77$ when they have residues $1\bmod 4$ and $2\bmod25$. So we reduce the equation in bth residue classes.
$\bmod 4\implies n^{122}\equiv1\implies n\equiv1\bmod2$ (all odd squares are $\equiv1\bmod4$)
$\bmod25\implies n^{122}+4n^{81}\equiv2\implies n^2+4n-2\equiv0$ (because $20$ is the Euler totient of $25$ so $n^{20}\equiv1\bmod25$ for all non-multiples of $5$)
So to get residues of $n\bmod25$ we should solve
$n^2+4n-2\equiv0$
We can use the quadratic formula. Thus
$n\equiv(2^{-1})(-4\pm\sqrt{-1})$
We have a Pythagorean triple $7^2+24^2=25^2$ where $24\equiv-1$, so the square roots of $-1\bmod25$ must be $7$ and its additive inverse $18$. (Since $25$ has only one prime factor there are no more such roots.) Then
$2^{-1}×(-4+18)\equiv7$
$2^{-1}×(-4+7)\equiv2^{-1}×(-4+32)\equiv14$
So we look for odd numbers that are either $7$ or $14$ greater than a multiple of $25$. The numbers in range that are $7$ greater than a multiple of $25$ are $7,32,57,82$ from which we accept $7,57$; and numbers $14$ greater than a multiple of $25$ are $14,39,64,89$ from which we take $39,89$.
Thus $\{7,39,57,89\}$.