For an exercise I had to find the second last number of $7^{(54^{1000} +2)}$ in the number system with base 9. I computed this number modulo $9^2 = 81$. This is what I found:
Since $\text{gcd}(7, 81) = 1$ and $\phi(81) = 54$ (where $\phi$ is the Euler totient function), I found that $$54^{1000} + 2 \equiv 2 \mod 54.$$
Therefore we have that $7^{(54^{1000} + 2)} \equiv 7^2 \equiv 49 \mod 81$.
Now this solution made me suspicious (because of the 9 appearing in my solution). Do I have to convert $49 = 5 \cdot 9 + 4 \cdot 1$ to find the second last digit in the number system with base 9? Or is $49$ the solution?