\(P=\left(x+1\right)\left(x+7\right)\left(x+3\right)\left(x+5\right)+2017\)
\(=\left(x^2+8x+7\right)\left(x^2+8x+15\right)+2017\)
\(=\left(x^2+8x+7\right)^2+8\left(x^2+8x+7\right)+16+2001\)
\(=\left(x^2+8x+7+4\right)^2+2001\)
\(=\left(x^2+8x+11\right)^2+2001\ge2001\)
\(P_{min}=2001\) khi \(x^2+8x+11=0\)