Finding sum of expressions involving coefficients of terms in the expansion $(1+x+x^2)^n$ We take:
$$(1+x+x^2)^n=a_0+a_1x+a_2x^2+a_3x^3+\cdots+a_{2n}x^{2n}$$
and we need to find the values of the expressions:
$$i)a_1+a_4+a_7+a_{10}+\cdots$$
$$ii)a_0-a_2+a_4-a_6+\cdots$$
I have solved similar expressions for eg.
$$1) a_0+a_2+a_4+\cdots$$
$$2) a_1+a_3+a_5+\cdots$$
$$3) a_0+a_3+a_6+\cdots$$
by using simple substitutions like $x=1, x=-1, x=\omega, x=\omega^2$ etc. but in these two expressions I'm completely stumped as I've tried using combinations of previous substitutions to create the kinds of expressions in part $i)$ and $ii)$ but was unsuccessful.
Any help would be appreciated.

Let $f(x) = (1 + x + x^2)^n$, and let $g(x) = f(x)/x$.

*

*For 1, consider $g(1) + g(\omega) + g(\omega^2)$, where $\omega = e^{2 \pi i/3}$.

*For 2, consider $f(i) + f(-i)$.

