# Find the last digit of the integer $n = 29583^{206}$

Find the last digit of the integer $n = 29583^{206}$

I understand a couple of methods of doing this such as the brute force of finding the pattern of the last digit but what I really need to know is has to do this using modular arithmetic for a large number. I can't really work out what the trick is to do this with such a large number.

Hint:

Working in modulo $10$,

$$29583 \equiv 3$$

Thus,

$$(29583)^2 \equiv 9 \equiv -1$$

The last digit of $n=29583^{206}$ is the remainder when it is divided by $10$.

$29583$ is neither divisible by $2$ nor $5$, hence not divisible by $10$.

Therefore by Euler's Totient Theorem :$29583^{\phi(10)}\equiv 1 \pmod {10}$

where $\phi(10)$ is the totient of $10$=number of numbers that are less than and prime to $10$=$10 \left(1-\dfrac12 \right)\left(1-\dfrac15 \right)=4$.

$\therefore 29583^4\equiv 1 \pmod {10}$

$\implies 29583^{204}=(29583^4)^{51}\equiv 1 \pmod {10}$

$\implies 29583^{206}\equiv 29583^2 \pmod {10}=(29580+3)^2 = 29580^2+2\cdot 29580 \cdot 3+9 \equiv 9 \pmod{10}$

Hence the last digit is $9$.

$23583=9\times3287$

$9^{206}≡10m+1≡1\mod 10$

$3287^2=10804369 ⇒ 10804369^{103}≡10 n +9$ ⇒ $3287≡9\mod 10$

$23583^{206}≡(10m+1)(10n+9)≡10p +9≡9\mod 10$

So last digit is $9$.

Hint: $$3^1=\color{red}{3}\\3^2=\color{red}{9}\\3^3=2\color{red}{7}\\3^4=8\color{red}{1}\\3^5=24\color{red}{3}\\\dots$$

The last digit repeats with a period of $4$, since $\phi(10)=4$.

Why is this the case?

Euler's theorem states that if $a\in\Bbb Z_n$ is invertible, then $$a^{\phi(n)}\equiv_n 1$$ Where $\phi(n)$ is the number of positive integers less than $n$, which is coprime to $n$. In this case $\phi(10)=4$, since there are $4$ positive integers less than $10$ and coprime to $10$. $$\{\color{red}{1},2,\color{red}{3},4,5,6,\color{red}{7},8,\color{red}{9}\}$$