\(A=\left(n-4\right)\left(n^2+n+1\right)+3\)
Để \(A⋮B\Rightarrow3⋮B\)
\(\Rightarrow n^2+n+1=Ư\left(3\right)=\left\{-3;-1;1;3\right\}\)
\(n^2+n+1=-3\Rightarrow n^2+n+4=0\) (vô nghiệm)
\(n^2+n+1=-1\Rightarrow n^2+n+2=0\) (vô nghiệm)
\(n^2+n+1=1\Rightarrow n^2+n=0\Rightarrow\left[{}\begin{matrix}n=0\\n=-1\end{matrix}\right.\)
\(n^2+n+1=3\Rightarrow n^2+n-2=0\Rightarrow\left(n-1\right)\left(n+2\right)=0\Rightarrow\left[{}\begin{matrix}n=1\\n=-2\end{matrix}\right.\)
Vậy \(n=\left\{-2;-1;0;1\right\}\)