# Number of permutations with conditions on sum of elements

I am trying to model game with dice. I am throwing three dice, sum up results on them. If result is equal or less than given number, that's a success, if not - failure. Probability function $p(n)$ is defined on $n$ from 3 to 18. I suspect it's recursive: $p(n) = p(n-1)$ + number of combinations (permutations?), elements of which sum to n. As I have a probability table, I can guess $p(3)=1/216;$ $p(4) = p(3) + 3/216;$ $p(5) = p(4) + 6/216$. My problem is that I can't understand, how to calculate for given n number of combinations (permutations?) which sum to given n. Anyone can give any advice on this?

Use generating functions[assuming distinct die, I have a method for identical die too!]: $$\text{Coefficient of }x^n\text{ in }\left(\sum_{k=1}^6x^k\right)^3$$ That would be in: $$\left(\frac{1-x^7}{1-x}\right)^3=(1-x^7)^3(1-x)^{-3}$$ I hope you can use the binomial theorem now? $$(a+b)^n=\sum_{k=0}^n \binom nk a^kb^{n-k}\\\binom nr=\binom{n+r-1}r\qquad(n<0)$$

• Nope, it's really not. Mar 13, 2015 at 16:36
• @DarkArchon see edit. Mar 13, 2015 at 16:38
• I am sorry, but it isn't any clearer to me. Still don't understand that is this thing and how it works. Mar 13, 2015 at 16:41
• @DarkArchon I wish to create an explanatory question on this topic, w8. Mar 13, 2015 at 16:45
• @Elaqqad that comment is uninformative, please explain what's wrong and i will gladly accept my mistake. Mar 13, 2015 at 16:48