What's the probability of getting three consecutive numbers among five dice throws?

807 Views Asked by At

The problem is stated as follows:

"Roll a 6-sided die five times. Note the results. The order of appearance is irrelevant.

Will there be three consecutive numbers among the results?

Example: if you roll [2,2,4,1,3] the answer is YES"

I have simulated this problem using Python, and I get an estimated probability of YES of P(YES) $\approx$ 0.4 [NB: Edited from 0.3 in the original post].

This is what I have thought of on the analytical solution so far:

We have a 5-tuple of numbers ranging from 1-6. There are $6^5 = 7776$ ordered outcomes and I want to count the ones that have three consecutive numbers.

Since the order does not matter, we can look at the different unique sets of outcomes, e.g. [X,X,X,X,Y], [X,X,X,Y,Y], [X,Y,Z,M,N] etc, classify which unique sets have three consecutive numbers and calculate all the permutations of these sets (ways to order them based on the number of unique integers) but I don't know a clever way to calculate all of the different possibilities. Can anyone help me on the way here?

2

There are 2 best solutions below

0
On BEST ANSWER

The event that you have three consecutive numbers is the union of five disjoint events:

$$ \overline3456\cup123\overline4\cup234\overline5\cup\overline2345\cup2345\;, $$

where a number with or without a bar indicates that that number is absent or present, respectively. The first four of these have the same probability, so we only need to calculate $2$ different probabilities. By inclusion–exclusion, we have

$$ \mathsf P(\overline3456)=\sum_{j=0}^3\binom3j(-1)^j\left(\frac{5-j}6\right)^5=\frac{125}{1296} $$

and

$$ \mathsf P(2345)=\sum_{j=0}^4\binom4j(-1)^j\left(\frac{6-j}6\right)^5=\frac5{81}\;. $$

Thus the probability to get three consecutive numbers is

$$ 4\cdot\frac{125}{1296}+\frac5{81}=\frac{145}{324}\approx45\%\;. $$

0
On

After rolling the die five times one obtains a 5-tuple of numbers, which we coin the result tuple. After removing the duplicates from the result, one is left with a set which we coin the reduced tuple. Clearly there can be no three consecutive numbers among reduced singlets and doublets. In other three cases we have the following "good" reduced tuples: $$\begin{align} &4\text{ (of }20)\text{ 3-tuples }: 123,234,345,456\\ &9\text{ (of }15)\text{ 4-tuples }: 1234,1235,1236,1345,1456,2345,2346,2456,3456\\ &6\text{ (of }\hphantom{0}6)\text{ 5-tuples }: 12345,12346,12356,12456,13456,23456 \end{align}$$

To compute the number of all result $n$-tuples which lead to a reduced $k$-tuple, one observes that this problem is equivalent to that of distributing $n$ balls among $k$ bins in such a way that each bin contains at least one ball, so that the number in question is:
$$ {n \brace k}k!, $$ where ${n \brace k}$ is the Stirling number of the second kind.

With this at hand the computation of the probability boils down to: $$ p=\frac{4{5 \brace 3}3!+9{5 \brace 4}4!+6{5 \brace 5}5!}{6^5}=\frac{145}{324}\approx 0.447531. $$

This perfectly agrees with result of numerical simulations.