$$\small{\text{
Find the units digit of $3^{777}$ or $3^{777} = x \pmod {10} $
}}$$
$$\small{\text{$
\begin{array}{lrcll}
1. & ~~gcd(10,3) &=& 1 \qquad & | \qquad gcd = \mathrm{greatest~common~ divisor}\\
2. & ~~\varphi{(10)} &=& 4 \qquad & | \qquad \varphi = \mathrm{Euler ~function}\qquad \varphi{(10)} = 10 \cdot (1-\dfrac{1}{2})\cdot (1-\dfrac{1}{5}) \\
3. & ~~a^{\varphi (n)} &\equiv& 1 \pmod{n} \qquad & | \qquad \mathrm{Euler's ~Theorem,~~ if~ } gcd(a,n)=1 \qquad \\
& ~~ 3^4 &\equiv& 1 \pmod {10} \qquad & | \qquad n = 10\qquad a = 3\\\\
& & 3^{777} \pmod{10}\\\\
& &\equiv& 3^{4\cdot 194 +1} \pmod{10}\\
& &\equiv& 3^{4\cdot 194}\cdot 3 \pmod{10}\\
& &\equiv& (3^4)^{194}\cdot 3 \pmod{10}\\
& &\equiv& (\underbrace{3^4}_{=1 \pmod{10}})^{194}\cdot 3 \pmod{10}\\\\
& &\equiv& 1^{194}\cdot 3 \pmod{10}\\
& &\equiv & \textcolor[rgb]{1,0,0}{3} \pmod{10}\\ \\
& \mathbf{the~ Units~ digit~ of ~} 3^{777} \mathbf{ ~is ~} 3\\
\end{array}
$ }}$$
.
When looking for the units digit of 3n, look at the value of mod(n,4). When this is 0, the units digit is 1, when it is 1 the units digit is 3, when it is 2 the units digit is 9, when it is 3 the units digit is 7.
mod(777,4) = 1, so the units digit of 3777 is 3.
.
$$\small{\text{
Find the units digit of $3^{777}$ or $3^{777} = x \pmod {10} $
}}$$
$$\small{\text{$
\begin{array}{lrcll}
1. & ~~gcd(10,3) &=& 1 \qquad & | \qquad gcd = \mathrm{greatest~common~ divisor}\\
2. & ~~\varphi{(10)} &=& 4 \qquad & | \qquad \varphi = \mathrm{Euler ~function}\qquad \varphi{(10)} = 10 \cdot (1-\dfrac{1}{2})\cdot (1-\dfrac{1}{5}) \\
3. & ~~a^{\varphi (n)} &\equiv& 1 \pmod{n} \qquad & | \qquad \mathrm{Euler's ~Theorem,~~ if~ } gcd(a,n)=1 \qquad \\
& ~~ 3^4 &\equiv& 1 \pmod {10} \qquad & | \qquad n = 10\qquad a = 3\\\\
& & 3^{777} \pmod{10}\\\\
& &\equiv& 3^{4\cdot 194 +1} \pmod{10}\\
& &\equiv& 3^{4\cdot 194}\cdot 3 \pmod{10}\\
& &\equiv& (3^4)^{194}\cdot 3 \pmod{10}\\
& &\equiv& (\underbrace{3^4}_{=1 \pmod{10}})^{194}\cdot 3 \pmod{10}\\\\
& &\equiv& 1^{194}\cdot 3 \pmod{10}\\
& &\equiv & \textcolor[rgb]{1,0,0}{3} \pmod{10}\\ \\
& \mathbf{the~ Units~ digit~ of ~} 3^{777} \mathbf{ ~is ~} 3\\
\end{array}
$ }}$$