# Last digit of $1238237^{18238456}$

So, I need to find the last digit of $1238237^{18238456}$. I will work this out in $\mathbb{Z}/10\mathbb{Z}$.

$$1238237^{18238456} \equiv 7^{18238456} = 49^{9119228} = 2401^{4559614} \equiv 1^{4559614} = 1 \mod 10$$

Is this correct? Also is this the only way to figure ot last digit of some large number?

The "standard" approach (which will work in a little more generality) is to replace $a^b \mod n$ with $(a \mod n)^{b \mod \varphi(n)} \mod n$. (For this to work, you need $a$ and $n$ to be relatively prime!) $\varphi$ is Euler's totient function. In this case, $\varphi(10) = 4$, so you take \begin{align*} 1238237 \mod 10 \quad &\equiv 7 \\ 18238456 \mod 4 \quad &\equiv 0 \end{align*} giving the result $7^0 = \boxed{1}$.
It's correct, but it would be much easier to apply Euler's theorem. Since $1238237$ is coprime to $10$, and $\varphi(10)=4$, we have $$1238237^4 \equiv 1 \bmod 10$$ Then use the fact that $4 \mid 18238456$.
The other way would be using the Euler-Fermat theorem. This states that if $\gcd(a,k)=1$, we have $$a^{\varphi(k)} \equiv 1 \mod k$$
Here $\varphi$ is the Euler-phi-funtion.
In this case you would use that $4 \mid 18238456$ and $\gcd(10,1238237)=1$, since $\varphi(10)=4$.