Same number on all the dies

A FiveThirtyEight Riddler puzzle.

By Vamshi Jandhyala in mathematics Riddler

March 27, 2020


You start with a fair 6-sided die and roll it six times, recording the results of each roll. You then write these numbers on the six faces of another, unlabeled fair die. For example, if your six rolls were 3, 5, 3, 6, 1 and 2, then your second die wouldn’t have a 4 on it; instead, it would have two 3s.

Next, you roll this second die six times. You take those six numbers and write them on the faces of yet another fair die, and you continue this process of generating a new die from the previous one.

Eventually, you’ll have a die with the same number on all six faces. What is the average number of rolls it will take to reach this state?

Extra credit: Instead of a standard 6-sided die, suppose you have an N-sided die, whose sides are numbered from 1 to N. What is the average number of rolls it would take until all N sides show the same number?

Computational Solution

from collections import Counter
from random import choices
import altair as alt
import pandas as pd


N = 20
runs = 10000
exp_number = []
for n in range(6, N):
    total_succ_cnt = 0
    for _ in range(runs):
        num_count = Counter(range(n))
        succ_cnt = 0
            num_count = Counter(choices(list(num_count.keys()),
            succ_cnt += 1
            if n in num_count.values():
        total_succ_cnt += succ_cnt
    exp_number.append({'N': n, 'Expected Number of Rolls': total_succ_cnt/runs})

                    y='Expected Number of Rolls:Q'


Here is the graph of number of faces on the dice Vs Expected number of rolls to get same number on all dies dies