I'm trying to write a probability function involving a 5-sided dice that has face values 2-5. I need to find the probability that the sum of n rolls of the dice equals k. I know I can find this through the coefficient of the x^k term after evaluating the following expression:
$$\prod_{k=1}^n(x^2+x^3+x^4+x^5+x^6)\ $$
I'd like to not have to search through the terms manually. Is there a different expression that can simply produce the coefficient value?
In order to obtain the coefficient it is convenient to use the coefficient of operator $[x^k]$ to denote the coefficient of $x^k$ in a series.
Comment:
In (1) we factor out $x^{2n}$.
In (2) we apply the rule $[x^{p-q}]A(x)=[x^p]x^qA(x)$ and use the finite geometric series formula.
In (3) we expand the numerator using the binomial theorem. We also apply the binomial series expansion.
In (4) we use the linearity of the coefficient of operator and apply the same rule as in (2). We also apply the binomial identity \begin{align*} \binom{-p}{q}=\binom{p+q-1}{q}(-1)^q \end{align*}.
In (5) we select the coefficient accordingly and restrict the upper limit of the sum since the exponent $k-2n-5j$ of $x$ has to be non-negative.