Calculate $$10^{(10^{10})} \pmod 7$$
With Fermat:
$$10^6 \equiv 1 \pmod 7 \Rightarrow 10^{6t} \equiv 1 \pmod 7$$
$$ \begin{eqnarray*} 10 & \equiv & -4 \pmod6\\ 10^{10} & \equiv & (-4)^{10}=[(4)^2]^5=(-2)^5=-32 \equiv 4 \pmod6\\ 10^{10} & = &6t+4 \\ 10^{{10}^{10}} & = & 10^{(6t+4)} \equiv 10^4 \equiv (-3)^4=81 \equiv 4 \pmod7\\ \end{eqnarray*}$$
Why did he write $10 \equiv -4 \; mod \; 6$, which lead to $10^4 \equiv (-3)^4 \pmod 6$ instead of positive $3^4$? Is what he wrote correct? Doesn't 10= 4 mod(6)? and so on.
As well,
Does $mod \; n$ always repeat when the value reaches 1? if so, why?