<s>[INST] How can I factor $x^{12}+x^{11}+\cdots+x+1$ in $\mathbb F_3[x]$? I can prove that $\mathbb F_3[x]$ is a UFD, so $f(x)=x^{12}+x^{11}+\cdots+x+1$ can be factored. And because neither 0, 1, nor 2 is a root of $f(x)$, all factors are more than 1 degrees.
But I don’t know how to factor $f(x)=x^{12}+x^{11}+\cdots+x+1$, or as another simple example, $g(x)=x^4+x^3+x+2$.
How do I find out factorizations of $f(x)$ and $g(x)$ in $\mathbb F_3[x]$? 
 [/INST] $$x^4+x^3+x+2=x^4+x(x^2+1)-1=(x^2+1)(x^2+x-1).$$
$$x^{12}+x^{11}+x^{10}+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1=$$
$$=x^{12}+x^{11}-2x^{10}-8x^9-5x^8+7x^7+16x^6+7x^5-5x^4-8x^3-2x^2+x+1=$$
$$=(x^3-x-1)(x^3+x^2-1)(x^3+x^2+x-1)(x^3-x^2-x-1).$$
</s>