<s>[INST] Need a closed formula for the generating function $x/(1+x+x^2)$. I used partial fractions but the obtained formula is only correct for the first two elements.
$\dfrac{x}{(1+x+x^2)}=\dfrac{x}{(1+a_1x)(1+a_2x)}=\dfrac{A_1}{(1+a_1x)+A_2(1+a_2x)}$
$x=\dfrac{-1 \pm\sqrt3i}{2}$  
Then let $a_1=\dfrac{-1+\sqrt3i}{2}$ and $a_2=\dfrac{-1-\sqrt3i}{2}$
and then calculated $A_1$ and $A_2$ to obtain the formula
$a_n=\dfrac{(-1)^n}{\sqrt3i} \cdot \left(\left(\dfrac{-1-\sqrt3i}{2}\right)^n-\left(\dfrac{-1+\sqrt3i}{2}\right)^n\right)$
The first three elements become $0$, $1$, $1$, but the answer from the Taylor series is $0$, $1$, $-1$.
 [/INST] Partial fractions are not the most efficient way here. 
Our expression is $\frac{x(1-x)}{1-x^3}$.  Expand $\frac{1}{1-x^3}$ using $\frac{1}{1-t}=1+t+t^2+t^3+t^4+\cdots$.
</s>