<s>[INST] What is the strategy to finding $\sum_{k=2}^{300} k^k \pmod 7$? I am stuck on this modular arithmetic problem for homework practice: 
$$\sum_{k=1}^{300} k^k \pmod 7$$
I am not quite sure how to approach this problem. I've tried finding a pattern between the sums but i do not think there is one. I know how to find mods of a^b (mod c) but for this question i am clueless. Any hints and help appreciated.
 [/INST] It does repeat, but only after $7*6 = 42$ terms (the bases repeat in cycles of 7 while the exponents repeat in cycles of 6).  Try breaking it up like this
$$\sum_{k=1}^{43} 1^{1 + 7(k-1)} + \sum_{k=1}^{43} 2^{2+7(k-1)} + \sum_{k=1}^{43} 3^{3+7(k-1)} + \sum_{k=1}^{43} 4^{4+7(k-1)} + \sum_{k=1}^{43} 5^{5+7(k-1)} + \sum_{k=1}^{43} 6^{6+7(k-1)} + \sum_{k=1}^{42} 7^{7+7(k-1)}$$
Now, the exponents can be reduced $\bmod{6}$, since $a^{6} \equiv 1 \bmod{7}$ for every $a \neq 0$. This gives
$$\sum_{k=1}^{43} \left( 1^{1 + (k-1)} +  2^{2+(k-1)} +  3^{3+(k-1)} +  4^{4+(k-1)} +  5^{5+(k-1)} +  6^{(k-1)}\right)$$
or equivalently
$$7\sum_{k=1}^{6} \left(1^{1 + (k-1)} +  2^{2+(k-1)} +  3^{3+(k-1)} +  4^{4+(k-1)} +  5^{5+(k-1)} +  6^{(k-1)}\right) + 1^{1} +  2^{2} +  3^{3} +  4^{4} +  5^{5} +  6^{0}$$
</s>