What is the remainder left after dividing $1! + 2! + 3! + ... + 100!$ by $5$?

I have this question as a homework.

What is the remainder left after dividing $1! + 2! + 3! + \cdots + 100!$ by $5$?

I tried this: I noticed that every $n! \equiv 0 \pmod{5}$ for every $n\geq 5$.

For $n < 5$:

$$\begin{align*} 1! &\equiv 1 \pmod{5} \\ 2! &\equiv 2 \pmod{5} \\ 3! &\equiv 1 \pmod{5} \\ 4! &\equiv 4 \pmod{5} \\ \end{align*}$$

So $1! + 2! + \cdots + 100! \equiv 8 \equiv 3 \pmod{5}$. Therefore the remainder is $3$. Am I thinking properly?

Thanks a lot.


To complement the other answer in less theory-heavy terms, you can view it as:

$$1! + 2! + 3! + 4! + 5! (1 + 6 + [6 \times 7] + \dots + [6 \times \dots \times 100])$$

The final term is clearly divisible by $5$; so we just need to look at $1! + 2! + 3! + 4!$ and its remainder, as you did.


For the sake of an answer:

YES. You are thinking properly. What you did is nice and correct.

Similar Related questions:

What is the remainder when $1! + 2! + 3! +\cdots+ 1000!$ is divided by $12$?

what is the remainder when $1!+2!+3!+4!+\cdots+45!$ is divided by 47?