[Math] Finding the last digit of $3^{729}$

elementary-number-theorymodular arithmetic

I'm practicing for my algebra exam but I stumbled on a question I don't know how to solve.

Let $N = 3^{729}$. What is the last digit of $N$?

The example answer says

Since $\gcd(3, 10) = 1$, check that
$3^4 = 81 = 1 \pmod {10}$:
Now, $729 = 182 \times 4 + 1,$ so we get we get (that might be a typo or missed a step)
$3^{729} = 3 \pmod {10}$.

Can anybody help me with this question? Thanks so much!

Best Answer

Every digit 0 thru 9 has a pattern of 4 digits when raised to an exponential power. Simply divide the power by 4 and the remainder shows you where you are at in the pattern. Here are the patterns for all 10 digits. Note that remainder 1 corresponds to the first digit in the pattern and remainder 2 corresponds to the second digit in the pattern. Remainder 3 corresponds to the third digit and remainder 0 (the power is divisible by 4) corresponds to the fourth digit in the pattern. Try a few yourself using a calculator and you will get the hang of it.

0,0,0,0   
1,1,1,1   
2,4,8,6   
3,9,7,1   
4,6,4,6   
5,5,5,5   
6,6,6,6   
7,9,3,1   
8,4,2,6   
9,1,9,1