Ta có: \(\left(x^2+x+1\right)\left(x^2+x+2\right)-12\)
\(=\left(x^2+x\right)^2+3\left(x^2+x\right)+2-12\)
\(=\left(x^2+x\right)^2+3\left(x^2+x\right)-10\)
\(=\left(x^2+x+5\right)\left(x^2+x-2\right)\)
\(=\left(x^2+x+5\right)\left(x+2\right)\left(x-1\right)\)