Finding the last digit of $3^{729}$

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   

By Euler's theorem, if $\gcd(a, m) = 1$ then $$ a^{\phi(m)} \equiv 1 \pmod{m} $$ In case $m = 10$ you have $\phi(10) = 4$.

In this case: $\gcd(3, 10) = 1$, so: $$ 3^{729} \equiv 3^{182 \cdot 4 + 1} \equiv (3^4)^{182} \cdot 3^1 \equiv 1 \cdot 3 \equiv 3 \pmod{10} $$ I.e., the result is 3.


$3^1 \equiv 3(\mod 10)$

$3^{2} \equiv -1 (\mod 10) $

$3^3 \equiv 7 (\mod 10)$

$3^{4} \equiv +1 (\mod 10) \implies 3^{4k} \equiv +1 (\mod 10)$

$3^{4k} \cdot 3 \equiv 3 (\mod 10)$

$3^{4k} \cdot 3^2 \equiv -1 (\mod 10)$

$3^{4k} \cdot 3^3 \equiv 7 (\mod 10)$

$729= 4k+1 \implies 3^{729} \equiv 3 (\mod 10)$