Finding the coefficient of a generating function Given $f(x) = x^4\left(\frac{1-x^6}{1-x}\right)^4 = (x+x^2+x^3+x^4+x^5+x^6)^4$. This is the generating function $f(x)$ of $a_n$, which is the number of ways to get $n$ as the sum of the upper faces of four thrown dice.
How do I calculate a coefficient from said generating function, for example $a_{17}$?
I could of course write it all out, but that would take a lot of time. Is there a quicker way to do it?

I've rewritten the formula as $x^4(1-x^6)^4\left(\frac1{1-x}\right)^4$, giving me to find the coefficient of $x^{17-4}=x^{13}$ of $(1-x^6)^4\left(\frac1{1-x}\right)^4$. I'm, however, stuck there.
 A: You want:
\begin{align}
[z^{17}] z^4 (1 - z^6)^4 (1 - z)^{-4}
  &= [z^{13}] (1 - 4 z^6 + 6 z^{12} - 4 z^{18} + z^{24}) 
                \cdot \sum_{k \ge 0} \binom{-4}{k} (-1)^k z^k \\
  &= [z^{13}] (1 - 4 z^6 + 6 z^{12}) \cdot \sum_{k \ge 0} \binom{k + 3}{3} z^k \\
  &= \binom{16}{3} - 4 \cdot \binom{10}{3} + 6 \cdot \binom{4}{3} \\
  &= 104
\end{align}
A: $$f(x) = x^4\left(\frac{1-x^6}{1-x}\right)^4 = (x+x^2+x^3+x^4+x^5+x^6)^4=x^4(1+x+^2+x^3+x^4+x^5)^4=\\
=x^4\left(\sum_{k=0}^{5}x^k\right)^4=x^4\left(\frac{1-x^6}{1-x}\right)^4=x^4(1-x^6)^4(1-x)^{-4}=\\=x^4\sum_{j=0}^{4}(-1)^j\binom{4}{j}x^{6j}\sum_{h=0}^{\infty}(-1)^h\binom{-4}{h}x^h$$
Note that $(-n)!=(-n)(-n-1)(-n-2)\cdots=\infty$, and $\binom{-n}{k}=\frac{(-n)!}{k!(-n-k)!}=(-1)^k\frac{n^{(k)}}{k!}=(-1)^k\frac{(n+k-1)_k}{k!}=(-1)^k\binom{n+k-1}{k}$ so
$$f(x)=x^4\sum_{j=0}^{4}(-1)^j\binom{4}{j}x^{6j}\sum_{h=0}^{\infty}\binom{h+4-1}{h}x^h
$$
Any exponent S of the polynomial will come from the sum  $S=4+6j+h \rightarrow h=S-6j-4$ and it coefficient will be
$$c(S)=\sum_{j=0}^{4}(-1)^j\binom{4}{j}\binom{S-6j-1}{S-6j-4}$$
where$\binom{S-6j-1}{3}\neq 0$ iff $S-6j-1\geq 3$ i.e. $j\leq \frac{S-4}{6}$. So
$$c(S)=\sum_{j=0}^{\lfloor\frac{S-4}{6}\rfloor}(-1)^j\binom{4}{j}\binom{S-6j-1}{3};\ S\in [4,24]_{\Bbb N}$$
