<s>[INST] Find generating function of sequences: $a_n=(n^2+n+1)_{n\ge0},b_n=(2^{1+[\frac{n}{3}]})_{n\ge 0}$ Find generating function of sequences: $a_n=(n^2+n+1)_{n\ge0},b_n=(2^{1+[\frac{n}{3}]})_{n\ge 0}$
For the first function, generating function is trivial:
$$f(x)=\sum\limits_{n=0}^{\infty}a_nx^n=\sum\limits_{n=0}^{\infty}(n^2+n+1)x^n=\frac{n^2+n+1}{1-x}$$
Second sequence: $2,2,2,4,4,4,8,8,8,...$
$$2+2x+2x^2+4x^3+...=(2+2x^2+4x^4+...)+x(2+4x^2+4x^4+...)$$
I don't know how to find close form of these partial sums.
Could someone give a hint?
 [/INST] $a_n$:
$$
f(x)=\sum_{n=0}^{\infty}x^n=\frac{1}{1-x}\\
\sum_{n=0}^{\infty}\left(1+n+n^2\right)x^n=f(x)+x\cdot f'(x)+x\left(x\cdot f'(x)\right)'$$
$b_n$:
$$\sum_{n=0}^{\infty}2^{n+1}\left(1+x+x^2\right)x^{3n}\\
=2\left(1+x+x^2\right)\sum_{n=0}^{\infty}\left(2x^3\right)^n\\
=2\left(1+x+x^2\right)\frac{1}{1-2x^3}$$
</s>