4. Determine all integers $m$ for which the number $m^{3}+m^{2}+7$ is divisible by the number $m^{2}-m+1$.
Solution. One

$$
m^{3}+m^{2}+7=\left(m^{2}-m+1\right)(m+2)+(m+5)
$$

it follows that $m^{2}-m+1$ is a divisor of $m+5$. An obvious solution is $m=-5$.

Let $m \neq-5$. Then $\left|m^{2}-m+1\right| \leq|m+5|$. From

$$
m^{2}-m+1=\left(m-\frac{1}{2}\right)^{2}+\frac{3}{4}>0
$$

it follows that $m^{2}-m+1 \leq|m+5|$. We have two possibilities:

$$
m^{2}-m+1 \leq m+5 \text { or } m^{2}-m+1 \leq-m-5
$$

The case

$$
m^{2}-m+1 \leq-m-5 \text {, i.e., } m^{2}+6 \leq 0
$$

is not possible. From $m^{2}-m+1 \leq m+5$ it follows that $m^{2}-2 m-4 \leq 0$ or $(m-1)^{2} \leq 5$. The latter inequality is satisfied for $m \in\{-1,0,1,2,3\}$. By checking, it is found that only $m=0$ and $m=1$ satisfy the initial condition.

Finally, $m \in\{-5,0,1\}$.