TITLE: Last digit of large powers
QUESTION [5 upvotes]: Define the sequence $a_1, a_2,...$ by $a_1=7$ and where $a_{n+1} = a_n^7$.
1) Find the last digit of $a_{1876}$, ie $7(^7)(^7)(^7)(^7)(^...)$
Now, I understand that the last digit of powers of 7 repeat every 4 powers (i think), so the answer has something to do with integers modulo 4. While I was working on this, I found than $a_n$ can be written as $a_n = 7^{(7^{n-1})}$, not sure if this is correct or if it helps.

REPLY [2 votes]: The order of $7$ mod $100$ is $4$, i.e. $7^4 = 2401 \equiv 1 \mod 100$, so $7^{4i+j} \equiv 7^j (\bmod 100)$ for any integers $i$ and $j$.
Since $4$ divides $100$, this is also true mod $4$.
Now $a_n = 7^{7^{n-1}}$, and $2008$ is divisible by $4$ so $7^{2008} \equiv 7^0 = 1 (\bmod 4)$, and $a_{2009} \equiv 7^{1} = 7 (\bmod 100)$.
As for $b_{2009}$, we have $b_1 = 7 \equiv 3 (\bmod 4)$, and since $3^3 = 27 \equiv 3 (\bmod 4)$ we get $b_n \equiv 3 (\bmod 4)$ for all $n \ge 1$,
and so for $n \ge 2$, $b_n \equiv 7^{b_{n-1}} \equiv 7^3 \equiv 43 (\bmod 100)$.