$\begin{array}{r}\text { 4. Let }\left(x^{1997}+x^{1999}+3\right)^{1998}=a_{0}+a_{1} x+ \\ a_{2} x^{2}+\cdots+a_{n} x^{n} \text {. Then } a_{0}-\frac{a_{1}}{2}-\frac{a_{2}}{2}+a_{3}-\frac{a_{4}}{2} \\ -\frac{a_{5}}{2}+\cdots+a_{3 k}-\frac{a_{3 k+1}}{2}-\frac{a_{3 k+2}}{2}+\cdots+a_{n}=\end{array}$
$4.2^{1998}$
Let $x=\frac{-1+\sqrt{3} i}{2}=w$, then $x^{3 k}=1, x^{3 k+1}=w$, $x^{3 k+2}=w^{2}, 1+w+w^{2}=0$. Substitute $x=w$ into the original expression,
$$
\begin{aligned}
\text { Left side } & =\left(w^{2}+w+3\right)^{1998}=\left(w^{2}+w+1+2\right)^{1998} \\
& =2^{1998},
\end{aligned}
$$
$$
\begin{aligned}
\text { Right side }= & a_{0}+a_{1} w+a_{2} w^{2}+a_{3}+a_{4} w+a_{5} w^{2} \\
& +\cdots \\
= & \left(a_{0}-\frac{a_{1}}{2}-\frac{a_{2}}{2}+a_{3}-\frac{a_{4}}{2}-\frac{a_{5}}{2}+\cdots\right) \\
& +\left(\frac{\sqrt{3}}{2} a_{1}-\frac{\sqrt{3}}{2} a_{2}+\cdots\right) i .
\end{aligned}
$$

Compare the real parts of the complex numbers on both sides to get the desired result.