Find the last digit of $$77777^{77777}$$

I got a pattern going for $77777^n$ for $n=1, 2, ....$ to be:

$$7, 9, 3, 1$$ for $n = 1, 2, 3, 4$ respectively.

The idea is:

$$77777^{77777} \pmod{10}$$

I see that:

$$77777^n \equiv 77777^{n + 4} \pmod{10}$$

Using the spotted pattern, but letting $n = 77777$ doesnt help at all.

Please give hints only...!


Observe that:

$$77777\equiv1\pmod{4}\implies77777^{77777}\equiv77777^1\equiv7\pmod{10}$$

In other words:

$$77777^{77777}\equiv77777^{(77777\bmod{4})}\equiv77777^{1}\equiv7\pmod{10}$$

Some clarifications:

  • You've already noticed that $77777^{n}\bmod{10}=77777^{(n\bmod{4})}\bmod{10}$
  • It's easy to observe that every number ending with $76$ is divisible by $4$
  • Therefore every number ending with $77$ is congruent to $1\bmod{4}$
  • Therefore $77777\bmod{4}=1$, hence $77777^{(77777\bmod{4})}=77777^{1}$

Conclusion: $77777^{77777}\bmod{10}=77777^{(77777\bmod{4})}\bmod{10}=77777^{1}\bmod10=7$


Hint:

  1. The last digit of $7777777^n$ is equal to the last digit of $7^n$.
  2. The pattern for $n=1,2,3,4$ is, indeed, $7,9,3,1$. How does that pattern continue? Take a look at the last digit of $77777^n$ for $n$ from $1$ to $8$ .

$\varphi(10) = \varphi(2 \times 5) = \varphi(2) \times \varphi(5) = (2-1)(5-1) = 4 $

Since $\gcd(7,10) = 1,$ then $7^4 \equiv 1 \pmod{10}$

Note that $77777 \equiv 777 \times 100 + 76 + 1 \equiv 1 \pmod 4$

So \begin{align} 77777^{77777} \pmod{10} &\equiv 7^{77777} \pmod{10}\\ &\equiv 7^{4(\text{something})+1} \pmod{10}\\ &\equiv (7^4)^\text{something} \times 7^1 \pmod{10}\\ &\equiv 1^\text{something} \times 7 \pmod{10}\\ &\equiv 7 \pmod{10} \end{align}