[Math] How to find the last digits of large numbers using modular arithmetic

elementary-number-theorymodular arithmetic

I know I have to consider things base 10 and use the multiplicative and additive properties of modular arithmetic. But I still am not sure how to do this.

For example: can someone help me with showing the methods of getting the last digit to these numbers?

1) $(3^5)^7$

2) $(7^5)^3$

3) $(11^{10})^6$

4) $(8^5)^4$

Thanks!

Best Answer

As $3$, for instance, is prime to $10$, we can apply Euler's theorem: $3^4\equiv 1\mod 10$, hence $$\bigl(3^5\bigr)^7=3^{35}\equiv3^{35\bmod4}\mod 10=3^3\equiv 7\mod 10.$$ As to $8$, which is not coprime to $10$, its powers modulo $10$ follow this pattern: $$\begin{array}{c|cccccc} n&1&2&3&4&5&\dots\\ \hline 8^n&8&4&2&6&8&\dots \end{array}$$ so $8^n\equiv 8^{n\bmod4}\mod 10$ if we agree to represent integers modulo $4$ by a number in $\{1,2,3,4\}$ instead of $\{0,1,2,3\}$. Thus $$\bigl(8^{5}\bigr)^4=8^{20}\equiv8^4\equiv 6.$$