Let us find the remainders of $\dfrac{6^n}{7}$,
Remainder of $6^0/7 = 1$
Remainder of $6/7 = 6$
Remainder of $36/7 = 1$
Remainder of $216/7 = 6$
Remainder of $1296/7 = 1$
This pattern of $1,6,1,6...$ keeps on repeating. Why is it so? I'm asking in general, that is for every case of type $a^n/b$'s remainder keeps on repeating as we increase $n$.
P.S: This is a follow up question of my previous question.
The reason is simple: a remainder can be expressed as a function of the previous remainder alone.
Indeed, let $r_n=6^n\bmod 7$, i.e. $6^n=7q_n+r_n$.
Then $\color{blue}{r_{n+1}}=6^{n+1}\bmod 7=(6\cdot6^n)\bmod 7=(42q_n+6r_n)\bmod 7=\color{blue}{(6r_n)\bmod 7}.$
As there is a finite number of possible remainders, the sequence must be periodic.
$$\begin{align}1&&\to1\\6&\to6\cdot1&\to6\\36&\to6\cdot6&\to1\\216&\to6\cdot1&\to6\\1296&\to6\cdot6&\to1\\\cdots\end{align}$$ or if you prefer $$\begin{align}1&\to1\\6\cdot1&\to6\\6\cdot6&\to1\\6\cdot1&\to6\\6\cdot6&\to1\\\cdots\end{align}$$