<s>[INST] $\sum_{n=1}^{2017}\left(\left((n+2)^4\bmod{(n+1)^4}\right)\bmod{4}\right)$ 
What's
$$\sum_{n=1}^{2017}\left(\left((n+2)^4\bmod{(n+1)^4}\right)\bmod{4}\right)$$

What have I tried?
$$(n+2)^4=n^4+8n^3+24n^2+32n+16$$
$$(n+1)^4=n^4+4n^3+6n^2+4n+1$$
Remainder:
$$4n^3+18n^2+28n+15$$
mod:
$$2n^2-1\pmod{4}$$
I can compute $\sum x^2$ but I don't know what to do with $$\sum_{n=1}^{2017}\left(2n^2-1\mod{4}\right)$$
 [/INST] Hint: Compute the sum of even and odd $n$ separately. That is, $$\sum_{n=1}^{2b+1}{(2n^2-1\mod{4})} = \sum_{k=1}^{b}{(2(2k)^2-1\mod{4})} + \sum_{k=0}^{b}{(2(2k+1)^2-1\mod{4})}$$
Just a word of caution: If $a \mod{4} \in \{0,1,2,3\}$ then it is useful to use $2n^2+3$ instead of $2n^2-1$, especially when $n$ is even.
</s>