TITLE: Formula for working out the number of dice combinations resulting in a given value
QUESTION [13 upvotes]: It's been about nine years since I last undertook any formal mathematical training, and I am wrestling with generating probability curves in R.
What I want to know is, for a dicepool of an arbitrary number of d10s, how many combinations will result in a given value?
At the beginning and end of the range, this is easy to work out since with 5d10, there's only one combination which will result in 5: All 1s. For 6, once dice needs to be 2, so there are five combinations. That part, I'm not having issues with. But as you get into the midrange, the number of possible combinations which could result in a given total increases exponentially. There must be some formula which can let me calculate this. I've been attempting to work it out from wikipedia pages for most of the afternoon, but my grasp of mathematical jargon is now non-existent, so I am having some issues.
If someone has a formula I can plug numbers into, that would be fantastic.

REPLY [5 votes]: The answer that Raskolnikov gave is the generating function of the number of ways to roll a given total.  Multiplying polynomials convolves their coefficients as functions of their exponents.  This is just what is needed for computing the number of ways to roll a given total.  The polynomial for an $n$ sided die is
$$
x\frac{x^n-1}{x-1}
$$
Just multiply one such polynomial for each $n$-sided die.