Last Page Build: 2025-06-28 01:31:16 +0100


Tenzi

Ari
Published: 2024-10-04

Writeup for Fiddlers How Many Dice Can You Roll the Same? from 2024-10-04.

Basic Puzzle (\(n\)=3)

Let \(Y\) be the random variable which denotes the number of dice left on the table after the first roll of \(n=3\) dice. Let \(X_1, \dots, X_n\) denote the random variables which represent each of the \(n\) dice.

Now if we want \(Y=1\), we need all 3 dice to be different. If all 3 dice were different, we must make a choice, which dice to leave on the table. If we pick uniformly at random, we pick each dice with probability \(1/3\).

Thus, for \(Y=1\), . Thus, we have 6 choices for the first dice, 5 choices for the second dice and 4 choices for third die. However, there are \(\binom{3}{1}\) choices for each dice to be the first dice.

\[\begin{align*} \text{ }\text{Pr}\left[Y=1\right] &= \frac{6 \times 5 \times 4}{6^3} \times \frac{1}{3}\times \binom{3}{1} &= 20/36 \end{align*}\]

Now for \(Y=2\), we need any 2 dice to be the same. Thus, we have 6 choices for the first dice, which decides the second dice, and then 5 choices for the third. However, we have 3 ways to select 2 dice. There is no randomness for which dices stay on the table (the two that were same).

\[\begin{align*} \text{ }\text{Pr}\left[Y=2\right] &= \frac{6\times5}{6^3}\times 1 \times \binom{3}{2} &= 15/36 \end{align*}\]

For \(Y=3\), we need all 3 dice to be the samne. Thus, we have 6 choices for the first dice, and that determines everything else.

\[\begin{align*} \text{ }\text{Pr}\left[Y=3\right] &= \frac{6}{6^3} \times 1 \times \binom{3}{3} &= 1/36 \end{align*}\]

Thus, we have

\[\mathbb{E}\left[Y\right] = 1\frac{20}{36} + 2\frac{15}{36} + 3\frac{1}{36} = 53/36\]

Extra Credit

We use shorthand \(Z= 1/6^n\). For any given value of \(n, y\) we ask the following questions:

These questions are best illustrated with an example:

\(n=4\)

\[\text{ }\text{Pr}\left[Y=1\right]= \frac{1}{Z}\cdot(6*5*4*3) \times \binom{4}{1} \times 1/4\]

\[\text{ }\text{Pr}\left[Y=2\right]= \frac{1}{Z}\cdot(6*5) \times \binom{4}{2} \times 1/2 + (6*5*4*\binom{4}{2})\]

\[\text{ }\text{Pr}\left[Y=3\right]= \frac{1}{Z}\cdot(6*5) \times \binom{4}{3}\]

\[\text{ }\text{Pr}\left[Y=4\right]= \frac{1}{6^{3}}\]

\(n=10\)

I could not come up with a closed form solution for \(n\)=10. The above analysis works but there’s a lot of cases to keep track of. For examples \(Y=3\), we could have the following arrangements, where each cell represents a dice color/number.

[3,3,3,1,0,0] + [3,3,2,2,0,0] + [3,3,2,1,1,0] + [3,3,1,1,1,1] + 
[3, 2, 2, 2, 1, 0] 

I conjecture there is a dynamic programming based solution here, where each case decomposes into multiple smaller cases). However, if we’re just looking for an answer, Monte Carlo simulation works.

Answer empirical 3.44945

  1. import numpy as np
  2. import pandas as pd
  3. from collections import Counter
  4. def many_left(lst):
  5. return Counter(lst).most_common()[0][1]
  6. num_trials = 80000
  7. for num_dice in [3]:
  8. print("n={}".format(num_dice))
  9. data = {i+1: 0 for i in range(num_dice)}
  10. for _ in range(num_trials):
  11. sample = np.random.randint(6, size=num_dice)
  12. data[many_left(sample)] += 1
  13. df = pd.Series(data)/num_trials
  14. ans = sum([idx*val for idx, val in df.items()])
  15. print('Answer empirical', ans)
  16. print('='*80)