$P=1^1+2^2+3^3+4^4+5^5+\ldots \ldots \ldots+48^{48}+49^{49}+50^{50}$. What is the remainder when $P$ is divided by 8 ?
A. 1
B. 3
C. 5
D. 6
E. 7
Is modular arithmetic, chinese remainder, or Fermat the solution?
$P=1^1+2^2+3^3+4^4+5^5+\ldots \ldots \ldots+48^{48}+49^{49}+50^{50}$. What is the remainder when $P$ is divided by 8 ?
A. 1
B. 3
C. 5
D. 6
E. 7
Is modular arithmetic, chinese remainder, or Fermat the solution?
Note that $n^n\equiv0 \pmod{8}$ for all even $n\geq 4$. Fermat gives $n^4\equiv 1\pmod{8}$ for odd $n$, so \begin{align*} n^n\equiv n\pmod{8} \quad\text{if $n\equiv 1\pmod{4}$} \\ n^n\equiv n^3\pmod{8} \quad\text{if $n\equiv 3\pmod{4}$}. \end{align*} Thus, \begin{align*} P &\equiv 2^2+\sum_{k=0}^{12} (4k+1)+\sum_{k=0}^{11} (4k+3)^3\\ &\equiv 4+(7\cdot 1+6\cdot 5)+(6\cdot 3+6\cdot (-1))\\ &\equiv 53 \equiv5\pmod{8}. \end{align*}