Find the remainder of the division Find the remainder when $f(x)=x^{2017}-1$ is divided by $(x^2+1)(x^2+x+1)$
I have expanded the function and factorized it. The remainder I had found was $-x^3-2x^2-3$ 
I am not sure if I was right ! So can anyone tell me the other way to solve it ..? 

$$x^{2017}-1=x((x^3)^{672}-1)+x-1\equiv x-1\pmod{x^3-1}\equiv x-1\pmod{x^2+x+1}$$
and $$x^{2017}-1=x((x^4)^{504}-1)+x-1\equiv x-1\pmod{x^4-1}\equiv x-1\pmod{x^2+1}$$
Luckily both remainders are same and $$(x^2+x+1,x^2+1)=1$$
