<s>[INST] Write a function as $\sum _{n=0} ^{\infty} a_n x^n$ We have $f(x) = (x+ x^2 + x^3 + x^4 + x^5 + x^6)^4$.
Now I want to write this as $\sum _{n=0} ^{\infty} a_n x^n$.
What I got:
$f(x) = (x+ x^2 + x^3 + x^4 + x^5 + x^6)^4 = x^4 (1+ x + x^2 + x^3 + x^4 + x^5)^4$
We know: $\frac{1}{1-x} = \sum _{n=0} ^{\infty} x^n$.
Note that $\displaystyle \frac{d^3}{dx^3} (\frac{1}{1-x})= \frac{6}{(1-x)^4}$.
Then $\frac{1}{(1-x)^4} = \frac{1}{6} \sum n (n-1) (n-2) x^{n-3}$, what gives
$x^4 \frac{1}{(1-x)^4} = \frac{1}{6} \sum n (n-1) (n-2) x^{n+1} = \frac{1}{6} \sum  (n-1) (n-2) (n-3) x^{n}$
If I look now on Wolfram Alpha at the expanded form, this expression is only correct for $4 \leq n \leq 9$. For $n \geq 10$ it gives other values of the coefficients. What goes wrong?
 [/INST] (can't leave a comment)
You'll want the multinomial series formula for this purpose:
$$\left(\sum_{j=1}^k a_j\right)^n=\sum_{\stackrel{n_j \geq 0}{\sum_{j=1}^k n_j=n}}\frac{n!}{\prod_{j=1}^k n_j!}\prod_{j=1}^k a_j^{n_j}$$
where the condition on the sum on the right means to sum all over the integer partitions of the power $n$.
</s>