4. Let $n$ be a positive integer, $\left(1+x+x^{2}\right)^{n}=a_{0}+a_{1} x+a_{2} x^{2}+\cdots+a_{2 n} x^{2 n}$, find the value of $a_{0}+a_{3}+a_{6}+a_{9}+\cdots$.

 untranslated text remains the same as the source text.
4. Let $\omega=\frac{1}{2}(-1+i \sqrt{3})$ (a complex cube root of 1), in the expansion, let $x=\omega$, then $0=a_{0}+a_{1} \omega+a_{2} \omega^{2}+\cdots+a_{2 n} \omega^{2 n}$.
Let $S_{1}=a_{0}+a_{3}+a_{6}+\cdots, S_{2}=a_{1}+a_{4}+a_{7}+\cdots, S_{3}=a_{2}+a_{5}+a_{8}+\cdots$, then $S_{1}-\frac{1}{2}\left(S_{2}+S_{3}\right)=0, \frac{\sqrt{3}}{2}\left(S_{2}-S_{3}\right)=0$, which means $S_{1}=S_{2}=S_{3}$.
In the expansion, let $x=1$, then $3^{n}=S_{1}+S_{2}+S_{3}$,
we get $S_{1}=a_{0}+a_{3}+a_{6}+\cdots=3^{n-1}$.