Sum of resulting values of dice

279 Views Asked by At

We have thrown with $n$ dice. The sum of resulting values is $k$. We are looking for a function $f$ which gives the number of throws, with we can construct $k$ with $n$ dice. Some example for $f(n,k)$: $f(3,3)=1$ because only the $1+1+1$ produces $3$. $f(3,4)=3$ because $1+1+2$, $1+2+1$, $2+1+1$ are the only sums, which give $4$.

Can anyone give me an explicit formula for $f$?

1

There are 1 best solutions below

1
On BEST ANSWER

Your $f(n,k)$ is the coefficient of $x^k$ in the expansion of $$p(x):=(x+x^2+x^3+x^4+x^5+x^6)^n\ .$$ (Explanation: Expanding this product produces $6^n$ terms of the form $x^s=x^{k_1+k_2+\ldots+k_n}$. Here $k_i\in[6]$ corresponds to the number thrown by dice number $i$, and the overall exponent $s$ is the total thrown with the $n$ dice. Collecting terms according to the value of $s$ collects, resp. automatically counts, all possible $n$-tuples $(k_1,k_2,\ldots, k_n)$ summing to $s$.)

Now $p(x)$ can be written as $$p(x)=\left(x{1-x^6\over 1-x}\right)^n=x^n(1-x)^{-n}(1-x^6)^n\ ,$$ and the binomial formula, resp, series then gives $$\eqalign{p(x) &= x^n\cdot\sum_{j\geq0}{n+j-1\choose j} x^j\cdot\sum_{l=0}^n{n\choose l}(-1)^l x^{6l}\cr &=x^n\cdot\sum_{r\geq0} x^r\left(\sum_{j+6l=r}(-1)^l{n+j-1\choose j} {n\choose l}\right) \ . \cr}$$ It follows that $$\eqalign{f(n,k)&=\sum_{j+6l=k-n}(-1)^l{n+j-1\choose j} {n\choose l}\cr &=\sum_{l=0}^{\lfloor(k-n)/6\rfloor} (-1)^l{k-6l-1\choose n-1}{n\choose l} \ .\cr}$$