Find the total number of positive integers

** n **not over

** 2015 **such that

**
n^4+5n^2+9 **is divisible by

** 5. **
Source: SMO, slightly modified

Well, we can ignore the 5n^2 term, which is always divisible by 5.

All we need is n^4 = 1 mod 5.

1^4 = 1 mod 5

2^4 = 16 = 1 mod 5

3^4 = 81 = 1 mod 5

4^4 = (2^4)^2 = 1 mod 5

5^4 = 0 mod 5

so this works for 4/5 of all integers.

Answer = 2015 * 4/5 = 1612