- 29,302
- 20,968
Although the idea of using the expected number works, that was only necessary because I thought the rules were more complicated. As it stands, here is a way to do it that could be programmed:
For ##n = 0## to ##7## (##n## is the number of 1's).
Calculate ##p(n)## (it's a binomial distribution - I'll not put too many details in this thread).
The criterion for success is to have at least one number occurring ##7-n## times, from ##14 - n## dice. We need all the patterns that meet this. For example, for ##n = 0##, the successful patterns are:
7, 7, 0, 0, 0
7, 6, 1, 0, 0
7, 5, 2, 0, 0
7, 5, 1, 1, 0
7, 4, 3, 0, 0
7, 4, 2, 1, 0
7, 4, 1, 1, 1
7, 3, 3, 1, 0
7, 3, 2, 2, 0
7, 3, 2, 1, 1
7, 2, 2, 2, 1
You could write a subroutine that would do this for any number. In this case, input ##14, 7, 5## and it would generate all patterns of ##5## numbers that have at least one ##7## and sum to ##14##.
Or, do a subroutine to do them all and then select any with a ##7##.
That's programming challenge #1!
Next, you need to calculate the probability of each of these patterns. In this case with five random possibilities - as we are assuming we are given the number of 1's. For example, for 7, 6, 1, 0, 0, you need the probability of getting 7 of one number, six of another and 1 of a third number. The way I would calculate this is:
60 sub-patterns (where a sub-pattern would be 7 x 2, 6 x 3, 1 x 4) - i.e. 60 is just 5 x 4 x 3.
For each of these the number of possibilities is ##\binom{14} {7} \binom {7} {6}##.
I.e. there are ##60 \times \binom{14} {7} \binom {7} {6}##. ways of getting the pattern 7, 6, 1, 0, 0.
You can add them all up and divide by ##5^{14}##, which is in general ##5^{14-n}##. We could call this ##q(n)## - the probability of success given ##n## 1's.
That's programming challenge #2!
Once you've done this, the total probability is just the sum of ##p(n)q(n)##.
Obviously an alternative is to do something similar for all 6 dice and work the addition of the 1's into the logic.
I can't see any short-cuts.
For ##n = 0## to ##7## (##n## is the number of 1's).
Calculate ##p(n)## (it's a binomial distribution - I'll not put too many details in this thread).
The criterion for success is to have at least one number occurring ##7-n## times, from ##14 - n## dice. We need all the patterns that meet this. For example, for ##n = 0##, the successful patterns are:
7, 7, 0, 0, 0
7, 6, 1, 0, 0
7, 5, 2, 0, 0
7, 5, 1, 1, 0
7, 4, 3, 0, 0
7, 4, 2, 1, 0
7, 4, 1, 1, 1
7, 3, 3, 1, 0
7, 3, 2, 2, 0
7, 3, 2, 1, 1
7, 2, 2, 2, 1
You could write a subroutine that would do this for any number. In this case, input ##14, 7, 5## and it would generate all patterns of ##5## numbers that have at least one ##7## and sum to ##14##.
Or, do a subroutine to do them all and then select any with a ##7##.
That's programming challenge #1!
Next, you need to calculate the probability of each of these patterns. In this case with five random possibilities - as we are assuming we are given the number of 1's. For example, for 7, 6, 1, 0, 0, you need the probability of getting 7 of one number, six of another and 1 of a third number. The way I would calculate this is:
60 sub-patterns (where a sub-pattern would be 7 x 2, 6 x 3, 1 x 4) - i.e. 60 is just 5 x 4 x 3.
For each of these the number of possibilities is ##\binom{14} {7} \binom {7} {6}##.
I.e. there are ##60 \times \binom{14} {7} \binom {7} {6}##. ways of getting the pattern 7, 6, 1, 0, 0.
You can add them all up and divide by ##5^{14}##, which is in general ##5^{14-n}##. We could call this ##q(n)## - the probability of success given ##n## 1's.
That's programming challenge #2!
Once you've done this, the total probability is just the sum of ##p(n)q(n)##.
Obviously an alternative is to do something similar for all 6 dice and work the addition of the 1's into the logic.
I can't see any short-cuts.
