Ta có:
\(B=\frac{2x^3+x^2+2x+4}{2x+1}=\frac{x^2.\left(2x+1\right)+2x+1+3}{2x+1}\)
\(B=\frac{\left(2x+1\right).\left(x^2+1\right)+3}{2x+1}\)
\(B=\frac{\left(2x+1\right).\left(x^2+1\right)}{2x+1}+\frac{3}{2x+1}\)
\(B=x^2+1+\frac{3}{2x+1}\)
Do x nguyên nên x2 + 1 nguyên
Để B nguyên thì \(\frac{3}{2x+1}\) nguyên
\(\Rightarrow3⋮2x+1\)
\(\Rightarrow2x+1\in\left\{1;-1;3;-3\right\}\)
\(\Rightarrow2x\in\left\{0;-2;2;-4\right\}\)
\(\Rightarrow x\in\left\{0;-1;1;-2\right\}\)
Vậy \(x\in\left\{0;-1;1;-2\right\}\)