# Repeating units digits - is this pattern meaningful or random?

I'm studying for the GRE, which often has problems involving the units digit of $n^m$, for some integers $n$ and $m$, e.g. "What is the units digit of $2^{300}$. I decided to create a table to see if there were patterns in the repeating patterns...

  | 1  | 2  | 3   | 4    | repeat
---------------------------------
0 | 0  | 0  | 0   | 0    | 1
1 | 1  | 1  | 1   | 1    | 1
2 | 2  | 4  | 8   | 16   | 4
3 | 3  | 9  | 27  | 81   | 4
4 | 4  | 16 | 64  | 256  | 2
5 | 5  | 25 | 125 | 625  | 1
6 | 6  | 36 | 216 | 1296 | 1
7 | 7  | 49 | 343 | 2401 | 4
8 | 8  | 64 | 512 | 4096 | 4
9 | 9  | 81 | 729 | 6561 | 2


...and noticed the right-hand column repeats: $1, 1, 4, 4, 2$. Is this there some structure here or is it just coincidence?

$$(x+5)^n=x^n+5^n+5\sum_{k=1}^{n-1}\binom nkx^k5^{n-k-1}$$
Thus, if instead of $x^n$ you take the corresponding power of $x+5$, you get $x^n$, plus a power of $5$, whose last digit is $5$, plus $5$ times a sum that contains $\sum_{k=1}^{n-1}\binom nk=2^n-2$ terms of the same parity and is thus even. Thus the last digit of $(x+5)^n$ is just shifted by $5$ with respect to $x^n$, so the periods of $x$ and $x+5$ are the same.