4. Let the function $f(x)=\frac{x^{2}-x+n}{x^{2}+x+1}\left(x \in \mathbf{R}\right.$ and $\left.x \neq \frac{n-1}{2}, n \in \mathbf{N}^{*}\right)$ have a minimum value of $a_{n}$ and a maximum value of $b_{n}$. Let $c_{n}=\left(1-a_{n}\right)\left(1-b_{n}\right)$. Then the sequence $\left\{c_{n}\right\}$
A. is an arithmetic sequence with a non-zero common difference
B. is a geometric sequence with a common ratio not equal to 1
C. is a constant sequence
D. is neither an arithmetic sequence nor a geometric sequence
4. Choose C.

Brief solution: From $y=\frac{x^{2}-x+n}{x^{2}+x+1}$ we get $(y-1) x^{2}+(y+1) x+(y-n)=0$. Since $x \neq \frac{n-1}{2}$, then $y \neq 1$.

The above quadratic equation has real roots, so $\Delta=(y+1)^{2}-4(y-1)(y-n) \geqslant 0$, which means $3 y^{2}-(4 n+6) y+(4 n-1) \leqslant 0$.

Given that $a_{n}, b_{n}$ are the two roots of the equation $3 y^{2}-(4 n+6) y+(4 n-1)=0$ with respect to $y$, then $a_{n}+b_{n}=\frac{1}{3}(4 n+6), a_{n} b_{n}=\frac{1}{3}(4 n-1)$.

Thus, $c_{n}=1-\left(a_{n}+b_{n}\right)+a_{n} b_{n}=1-\frac{1}{3}(4 n+6)+\frac{1}{3}(4 n-1)=-\frac{4}{3}$. Therefore, $\left\{c_{n}\right\}$ is a constant sequence.