Dice Rolling A Given Sum

If we have a set of n dice, each of which has k faces numbered 0
through k-1, in how many different ways can these dice give a
particular sum S?  

Assuming we regard the individual dice as distinct, there are 
obviously k^n different possible results, which could also be 
modeled as sequences of throwing a single k-sided die n times,
and keeping track of the order of the results as well as the
cumulative sum.  If n and k are small the exact answer can easily 
be computed combinatorially for each possible sum, but for large
values of n and k, such as n=k=256, we are better off applying 
the central limit theorem and dealing with proportions rather 
than absolute numbers.

Taking n=k=256 as an example, we have 256 independent random 
variables, each of which has a flat (rectangular) distribution with 
a mean of 255/2 and a standard deviation of 255/2sqrt(3).  Our 
"outcome population" is the sum of these individual populations, 
so it has a mean of 256(255/2) = 32640 and a standard deviation 
given by  sigma^2 = 256 (255/2sqrt(3))^2.  Therefore, we have 
sigma = 2040/sqrt(3) =~ 1177.79.  By the central limit theorem, 
it follows that the density of sequences for a given sum x is

                     exp( -[x-32640]^2 / 2(1177.79)^2 )
     d(x) = 256^256  ----------------------------------
                            (1179.79) sqrt(2 PI)

For an interval of width 1 surrounding x=32768, this gives the 
expected number of sequences equal to approximately 

                      0.00034015*256^256

so about 1 out of every 2939.88 sequences would give the sum 32768.

Return to MathPages Main Menu
Сайт управляется системой uCoz