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 ..? 

The hint:
$$f(x)=x^{2017}-x+x-1$$ and
$$x^{2016}-1=(x^4)^{504}-1$$ is divisible by $x^4-1=(x^2-1)(x^2+1).$
Also, $$x^{2016}-1=(x^3)^{672}-1$$ is divisible by $x^3-1=(x-1)(x^2+x+1),$
which gives that there is polynomial $g$ for which
$$f(x)=(x^2+1)(x^2+x+1)g(x)+x-1.$$ 
