The generating function for this sequence is
![f(x)=4+4x+4x^2+4x^3+x^4+x^6+x^8+\cdots](https://img.qammunity.org/2020/formulas/mathematics/college/z1r2smdq9ma05eo0rv8pzucc317qhe2yjp.png)
assuming the sequence itself is {4, 4, 4, 4, 1, 0, 1, 0, ...} and the 1-0 pattern repeats forever (as opposes to, say four 4s appearing after every four 1-0 pairs). We can make this simpler by "displacing" the odd-degree terms and considering instead the generating function,
![f(x)=3+4x+3x^2+4x^3+\underbrace{(1+x^2+x^4+x^6+x^8+\cdots)}_(g(x))](https://img.qammunity.org/2020/formulas/mathematics/college/8rh1wfinqidhzkgg195fhibvns9dierg4d.png)
where the coefficients of
follow a much more obvious pattern of alternating 1s and 0s. Let
![g(x)=\displaystyle\sum_(n=0)^\infty a_nx^n](https://img.qammunity.org/2020/formulas/mathematics/college/ocs2q807oupmvolfcxnhm06fq1sd8494nv.png)
where
is recursively given by
![\begin{cases}a_0=1\\a_1=0\\a_(n+2)=a_n&\text{for }n\ge0\end{cases}](https://img.qammunity.org/2020/formulas/mathematics/college/3pcj0e8aos333k9joy9ya4wqxo6i4fg85y.png)
and explicitly by
![a_n=\frac{1+(-1)^n}2](https://img.qammunity.org/2020/formulas/mathematics/college/t24v3bytcueoi7el1rwzl6v2ssnfr9l2n4.png)
so that
![g(x)=\displaystyle\sum_(n=0)^\infty\frac{1+(-1)^n}2x^n](https://img.qammunity.org/2020/formulas/mathematics/college/ztxc1h5fae449qno346tfvcxxbvyptnlqy.png)
and so
![\boxed{f(x)=3+4x+3x^2+4x^3+\displaystyle\sum_(n=0)^\infty\frac{1+(-1)^n}2x^n}](https://img.qammunity.org/2020/formulas/mathematics/college/ptdgv6rwydw58wzclsjfcc67mubflihy4y.png)