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