1) \(\left(x^2+3x+1\right)^2-1=\left(x^2+3x\right)\left(x^2+3x+2\right)=x\left(x+3\right)\left[\left(x^2+2x\right)+\left(x+2\right)\right]\)
\(=x\left(x+3\right)\left[x\left(x+2\right)+\left(x+2\right)\right]=x\left(x+3\right)\left(x+1\right)\left(x+2\right)\)
2) \(x^4+2012x^2+2011x+2012\)
\(=\left(x^4-x\right)+\left(2012x^2+2012x+2012\right)\)
\(=x\left(x^3-1\right)+2012\left(x^2+x+1\right)\)
\(=x\left(x-1\right)\left(x^2+x+1\right)+2012\left(x^2+x+1\right)\)
\(=\left(x^2+x+1\right)\left[x\left(x-1\right)+2012\right]\)
\(=\left(x^2+x+1\right)\left(x^2-x+2012\right)\)