<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] For this term: $\left((n+2)^4\bmod{(n+1)^4}\right)$, it's easy to see that for $n\ge 5$, this is just $\left((n+2)^4-{(n+1)^4}\right)$, since $\frac{7^4}{6^4}<2$. So after the first four terms we can just use the pattern of values $\bmod 4$ to complete the calculation, since for $k$ odd, $k^4\equiv 1 \bmod 4$ and for $k$ even, $k^4\equiv 0 \bmod 4$.
So for odd $n\ge 5$, we add $1-0\equiv 1$ to the sum and for even $n$ we add  $0-1\equiv 3$ to the sum, giving us $1007\cdot 1 + 1006 \cdot 3 = 4025$. 
Then in the first four terms, the odd terms are unaffected -- $1-0\cdot k \equiv 1$ no matter what $k$ is -- and the two even terms $n = 2,4$ contribute $1$ and $2$ to the sum respectively (from $k=3,2$ in $0-1\cdot k$) , giving a total of $4030$ for the whole sum.
</s>