<s>[INST] Remainder of $(1+x)^{2015}$ after division with $x^2+x+1$ 
Remainder of $(1+x)^{2015}$ after division with $x^2+x+1$

Is it correct if I consider the polynomial modulo $5$
$$(1+x)^{2015}=\sum\binom{2015}{n}x^n=1+2015x+2015\cdot1007x^2+\cdots+x^{2015}$$
RHS stays the same and then The remainder must be of the form $Ax+B$
$$x^{2015}+1\equiv Ax+B\pmod{1+x+x^2}$$
plug in $x=0\implies B=0$
plug in $x=1\implies A=-1\implies $ the remainder is $-x$
Is this a good way to solve the problem or were we lucky ?
 [/INST] use the division algorithm to write $$(1 + x)^{2015} = q(x)(x^2 + x+ 1)+ax + b\tag 1$$  the  roots of $x^2 + x+ 1 = 0$ are $\omega = e^{i2\pi/3}, \bar {\omega}.$  we need $$1 + \omega = e^{i\pi/3},1 + \bar \omega = e^{-i\pi/3}  $$  subbing $e^{i\pi/3}, e^{-i\pi/3}$ in $(1)$  gives us $$e^{\pm i2015\pi/3} = ae^{\pm i\pi/3} + b\to e^{\mp i\pi/3} = ae^{\pm 2i\pi/3} + b$$
gives you $$ a = -1, b = 0, \text{ the remainder is } -x $$
</s>