Lời giải:
Nếu $n=3k$ với $k$ tự nhiên.
$f(x)=x^{6k}+x^{3k}+1=(x^{6k}-1)+(x^{3k}-1)+3$
$=(x^3)^{2k}-1+(x^3)^k-1+3$
$=(x^3-1)[(x^3)^{2k-1}+....+1]+(x^3-1)[(x^3)^{k-1}+...+1]+3$
$=(x-1)(x^2+x+1)[(x^3)^{2k-1}+....+1]+(x-1)(x^2+x+1)[(x^3)^{k-1}+...+1]+3$
$=(x-1)g(x)[(x^3)^{2k-1}+....+1]+(x-1)g(x)[(x^3)^{k-1}+...+1]+3$
$\Rightarrow f(x)$ chia $g(x)$ dư $3$ (loại)
Nếu $n=3k+1$ với $k$ tự nhiên
\(f(x)=x^{2(3k+1)}+x^{3k+1}+1=x^{6k+2}+x^{3k+1}+1\\ =x^2(x^{6k}-1)+x(x^{3k}-1)+x^2+x+1\)
$=x^2[(x^3)^{2k}-1]+x[(x^3)^k-1]+x^2+x+1$
$=x^2(x^3-1)[(x^3)^{2k-1}+....+1]+x(x^3-1)[(x^3)^{k-1}+...+1]+x^2+x+1$
$=x^2(x-1)(x^2+x+1)[(x^3)^{2k-1}+....+1]+x(x-1)(x^2+x+1)[(x^3)^{k-1}+...+1]+x^2+x+1$
$=x^2(x-1)g(x)[(x^3)^{2k-1}+....+1]+x(x-1)g(x)[(x^3)^{k-1}+...+1]+g(x)\vdots g(x)$
Nếu $n=3k+2$ với $k$ tự nhiên
\(f(x)=x^{2(3k+2)}+x^{3k+2}+1=x^{6k+4}+x^{3k+2}+1\)
\(=x^4(x^{6k}-1)+x^2(x^{3k}-1)+x^4+x^2+1\)
$=x^4(x^{6k}-1)+x^2(x^{3k}-1)+x(x^3-1)+x^2+x+1$
Có:
$x^{6k}-1=(x^3)^{2k}-1\vdots x^3-1\vdots x^2+x+1$
$x^{3k}-1=(x^3)^k-1\vdots x^3-1\vdots x^2+x+1$
$x^3-1\vdots x^2+x+1$
$x^2+x+1\vdots x^2+x+1$
$\Rightarrow f(x)\vdots x^2+x+1$ hay $f(x)\vdots g(x)$
Vậy tóm lại với $n\not\vdots 3$ thì $f(x)\vdots g(x)$