For what $n$

a) the polynomial $x^{2 n}+x^{n}+1$ is divisible by $x^{2}+x+1$?

b) the polynomial $x^{2 n}-x^{n}+1$ is divisible by $x^{2}-x+1$?
a) Any polynomial of the form $x^{3 k}-1$ is divisible by $x^{3}-1$, and therefore by $x^{2}+x+1$. Thus, for $n=3 k+1$, $x^{2 n}+x^{n}+1=\left(x^{2 n}-x^{2}\right)+\left(x^{n}-x\right)+x^{2}+x+1$ is divisible by $x^{2}+x+1$.

Similarly, for $n=3 k+2$, $x^{2 n}+x^{n}+1=\left(x^{2 n}-x\right)+\left(x^{n}-x^{2}\right)+x^{2}+x+1$ is divisible by $x^{2}+x+1$.

And for $n=3 k$, $x^{2 n}+x^{n}+1=\left(x^{2 n}-1\right)+\left(x^{n}-1\right)-1$ is not divisible by $x^{2}+x+1$.

b) A polynomial of the form $x^{6 k}-1$ is divisible by $x^{6}-1=\left(x^{3}-1\right)\left(x^{3}+1\right)$, and $x^{3}+1$ is divisible by $x^{2}-x+1$. Therefore, the answer depends only on the remainder of the division of $n$ by 6. Let's check all 6 cases.

$x^{0}-x^{0}+1=3$ is not divisible by $x^{2}-x+1$.

$x^{2}-x+1$ - is divisible.

$x^{4}-x^{2}+1=\left(x^{4}+x\right)-\left(x^{2}-x+1\right)-2 x+2-$ is not divisible.

$x^{6}-x^{3}+1=\left(x^{6}-1\right)-\left(x^{3}+1\right)+3-$ is not divisible.

$x^{8}-x^{4}+1=\left(x^{6}-x^{2}\right)-\left(x^{4}+x\right)+\left(x^{2}-x+1\right)+2 x-$ is not divisible.

$x^{10}-x^{5}+1=\left(x^{10}+x\right)-\left(x^{5}-x^{2}\right)+x^{2}-x+1-$ is divisible.

## Answer

a) $n \equiv 1,2(\bmod 3) ; \quad$ b) $n \equiv 1,5(\bmod 6)$.