# How many ways can you roll an 18 from 5 dice?

## Homework Statement

How many ways can you roll an 18 from 5 dice? Assume the dice are different colors.

Factorials

## The Attempt at a Solution

I listed combinations of dice that would add to 18 as follows

66411
65511
55521
44442
33336
66312
65412
55431
44433
66222
65313
55224
44451

Since the dice are different colors, then 6, 6, 4, 1, 1 is distinct from 1, 1, 4, 6, 6. The number of orderings of each sum is 5!

So I have, as a solution: 13 x 5! = 1,560

If all the dice were identical then I'd have 460.

I am confused because this site https://wizardofodds.com/gambling/dice/2/ shows that my answer is double what they have.

I think my answer is correct, since my dice are not identical, but am perplexed as to how they got 780 and I get 460 for combinations.

Related Precalculus Mathematics Homework Help News on Phys.org
mfb
Mentor
The number of orderings of each sum is 5!
You have fewer orderings if you have repeated dice. As extreme example, something like "3 3 3 3 3" has just one ordering (it doesn't have a sum of 18 but that is not the point here).

You are looking for partitions of 18. There can be tricks to calculate them without casework, at least for distinguishable dice, but I'm not sure how to include the maximum of 6 here for the dice without checking a few cases separately.

You have fewer orderings if you have repeated dice. As extreme example, something like "3 3 3 3 3" has just one ordering (it doesn't have a sum of 18 but that is not the point here).

You are looking for partitions of 18. There can be tricks to calculate them without casework, at least for distinguishable dice, but I'm not sure how to include the maximum of 6 here for the dice without checking a few cases separately.
Thank you for your reply. So would 66411 have ordering of 5! / 2!2! = 120/4 = 30? If so when I did those calculations I only got 460.

It seems odd to me that my answer is exactly 2 times the answer from that site.

vela
Staff Emeritus
Homework Helper
It seems you missed some combinations. I think the following aren't already covered in your list.

64431
65322
64422
64332
55332
54432
33345

I brute-forced it and found there are 20 combinations that sum to 18.

Last edited:
Stephen Tashi
Since the dice are different colors, then 6, 6, 4, 1, 1 is distinct from 1, 1, 4, 6, 6.
If you are considering permutations of 5 things, you have to make them all distinct. So you are thinking of "6,6,4,1,1" as if it were ##6_a, 6_b, 4, 1_a, 1_b##. A different one of the 5! permutations is ##6_b,6_a, 4,1_b,1_a##.

However, if we consider the notation "6,6,4,1,1" to mean "The red die is 6, The orange die is 6, the yellow die is 4,..." etc. then interchanging ##6_a## with ##6_b## doesn't create a new situation.

Likewise if we imagine your table of combinations as having a heading over it giving the die color for each column, the interchanging the 5 entries in this heading does not always create a new situation. For example if the column headings were "die red, die orange, die yellow, die green, die blue" and the table entry is 6,6,4,1,1 then changing the column headings to "die orange, die red, die yellow , die green, die blue" does not change 6,6,4,1,1 to a new situation.

A scholarly paper about the problem: https://digitalscholarship.unlv.edu/cgi/viewcontent.cgi?article=1025&context=grrj

mfb
Mentor
Options and multiplity:

66411 - 30
66321 - 60
66222 - 10
65511 - 30
65421 - 120
65331 - 60
65322 - 60
64431 - 60
64422 - 30
64332 - 60
63333 - 5
55521 - 20
55431 - 60
55422 - 30
55332 - 30
54441 - 20
54432 - 60
54333 - 20
44442 - 5
44433 - 10

Sum: 780

This is 6.5 times 5!, it seems to be an accident that it is divisible by (5!/2). As a different example, for a sum of 7 we could get 5 options from "31111" and 10 options from "22111", for a total of 15.

Dick
Homework Helper
There is a simple way to solve problems like this, especially if you have a good calculator. The answer is the coefficient of ##x^{18}## in the expansion of ##(x+x^2+x^3+x^4+x^5+x^6)^5##. If you think about it for a little bit, you can probably figure out why.

• mattt, FactChecker, StoneTemplePython and 2 others
PeroK
Homework Helper
Gold Member
There is a simple way to solve problems like this, especially if you have a good calculator. The answer is the coefficient of ##x^{18}## in the expansion of ##(x+x^2+x^3+x^4+x^5+x^6)^5##. If you think about it for a little bit, you can probably figure out why.
A variation on this, if you don't have a good enough calculator is to use a tree approach.

Imagine throwing the dice in order one at a time. We can build up a tree of the numbers of ways of getting each number as we throw more dice. Symmetry helps and we can truncate the tree if the numbers are too high or low. E.g. after three dice we must have between 6 and 16 inclusive, if we want 18 after five dice.

The first two dice can be anything. This gives the pattern:

Total (number of ways) - after two dice.
2(1)
3(2)
4(3)
5(4)
6(5)
7(6)
8(5)
9(4)
10(3)
11(2)
12(1)

To get the number of ways of getting the totals after three dice note that to get 6 we can have ##2+4, \ 3+3, \ 4+2, \ 5+1##, where the first number is the total after two dice and the second number is the third throw. The number of ways of getting 6 after three dice, therefore, is the sum of the ways of getting 2-5 for two dice. This gives 10 ways to get 6 with three dice.

Following this method we get:

Total (number of ways) - three dice
6(10)
7(15)
8(21)
9(25)
10(27)
11(27)
12(25)
13(21)
14(15)
15(10)
16(6)

Then the totals for four dice are:

Total (number of ways) - after four dice
12(125)
13(140)
14(146)
15(140)
16(125)
17(104)

And, if you add those up you get ##780## as the number of ways of getting 18 with five dice.

Last edited:
Options and multiplity:

66411 - 30
66321 - 60
66222 - 10
65511 - 30
65421 - 120
65331 - 60
65322 - 60
64431 - 60
64422 - 30
64332 - 60
63333 - 5
55521 - 20
55431 - 60
55422 - 30
55332 - 30
54441 - 20
54432 - 60
54333 - 20
44442 - 5
44433 - 10

Sum: 780

This is 6.5 times 5!, it seems to be an accident that it is divisible by (5!/2). As a different example, for a sum of 7 we could get 5 options from "31111" and 10 options from "22111", for a total of 15.
Thank you for the reply. I missed some of the combinations. I have the correct answer now and it makes sense.

• SammyS
tnich
Homework Helper
There is a simple way to solve problems like this, especially if you have a good calculator. The answer is the coefficient of ##x^{18}## in the expansion of ##(x+x^2+x^3+x^4+x^5+x^6)^5##. If you think about it for a little bit, you can probably figure out why.
Actually, you don't need a fancy calculator to expand this polynomial. If you write
$$(\sum_{k = 1}^n {x^k})^n = (\frac {x-x^{k+1}} {1-x})^n$$
you can use a binomial expansion on the numerator. The denominator is related to the multichoose function.

tnich
Homework Helper
Actually, you don't need a fancy calculator to expand this polynomial. If you write
$$(\sum_{k = 1}^n {x^k})^n = (\frac {x-x^{k+1}} {1-x})^n$$
you can use a binomial expansion on the numerator. The denominator is related to the multichoose function.
By this method I get for ##n=5## the coefficient of ##x^{18}## is
$$\left( \begin{matrix} 5 \\ 0 \end{matrix} \right) \left( \left(\begin{matrix} 5 \\ 13 \end{matrix} \right)\right)- \left( \begin{matrix} 5 \\ 1 \end{matrix} \right) \left( \left(\begin{matrix} 5 \\ 7 \end{matrix} \right)\right)+ \left( \begin{matrix} 5 \\ 2 \end{matrix} \right) \left( \left(\begin{matrix} 5 \\ 1 \end{matrix} \right)\right) = 780$$
where
$$\left( \left(\begin{matrix} n \\ k \end{matrix} \right)\right) \equiv \left(\begin{matrix} n+k-1 \\ k \end{matrix} \right)$$
(This equation makes more sense if you think of it as finding the number of combinations of integers ##0 \leq n_k \leq 5## such that ##\sum_{k=1}^5 {n_k} = 13##, which is equivalent to the OP.)
I think that works intuitively. It is all of the combinations of 5 non-negative integers that sum to 13, less combinations where one integer is at least 6, plus combinations where two integers are at least 6. (There are no combinations in which three or more integers are at least 6.) The third term is needed to avoid double counting.

Last edited:
• PeroK
tnich
Homework Helper
Actually, you don't need a fancy calculator to expand this polynomial. If you write
$$(\sum_{k = 1}^n {x^k})^n = (\frac {x-x^{k+1}} {1-x})^n$$
you can use a binomial expansion on the numerator. The denominator is related to the multichoose function.
I see I messed this up. It should be
$$(\sum_{k = 1}^m {x^k})^n = (\frac {x-x^{m+1}} {1-x})^n$$

• FactChecker
haruspex
Homework Helper
Gold Member
You are looking for partitions of 18.
Isn't that for the case of indistinguishable dice? Or did you mean composition?

mfb
Mentor
Ah right, compositions have an order.
Anyway, you still get casework from the maximum of 6. Filling a table die by die is easier (equivalent to the approach with polynomials).

tnich
Homework Helper
By this method I get for ##n=5## the coefficient of ##x^{18}## is
$$\left( \begin{matrix} 5 \\ 0 \end{matrix} \right) \left( \left(\begin{matrix} 5 \\ 13 \end{matrix} \right)\right)- \left( \begin{matrix} 5 \\ 1 \end{matrix} \right) \left( \left(\begin{matrix} 5 \\ 7 \end{matrix} \right)\right)+ \left( \begin{matrix} 5 \\ 2 \end{matrix} \right) \left( \left(\begin{matrix} 5 \\ 1 \end{matrix} \right)\right) = 780$$
where
$$\left( \left(\begin{matrix} n \\ k \end{matrix} \right)\right) \equiv \left(\begin{matrix} n+k-1 \\ k \end{matrix} \right)$$
(This equation makes more sense if you think of it as finding the number of combinations of integers ##0 \leq n_k \leq 5## such that ##\sum_{k=1}^5 {n_k} = 13##, which is equivalent to the OP.)
I think that works intuitively. It is all of the combinations of 5 non-negative integers that sum to 13, less combinations where one integer is at least 6, plus combinations where two integers are at least 6. (There are no combinations in which three or more integers are at least 6.) The third term is needed to avoid double counting.
More generally, when throwing n dice with m sides each (numbered from 1 to m), the number of ways the throw can show a total of T spots is:
##\sum_{k=0}^{floor \left(\frac {T-n} m \right)} (-1)^k \begin{pmatrix} n\\k \end{pmatrix} \left(\begin {pmatrix} n \\ T-n-mk \end{pmatrix}\right)##