## Problem

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
'default')
alt.renderers.enable(
= 20
N = 10000
runs = []
exp_number for n in range(6, N):
= 0
total_succ_cnt for _ in range(runs):
= Counter(range(n))
num_count = 0
succ_cnt while(True):
= Counter(choices(list(num_count.keys()),
num_count =list(num_count.values()),
weights=n))
k+= 1
succ_cnt if n in num_count.values():
break
+= succ_cnt
total_succ_cnt 'N': n, 'Expected Number of Rolls': total_succ_cnt/runs})
exp_number.append({
alt.Chart(pd.DataFrame(exp_number)).mark_line().encode(='N:Q',
x='Expected Number of Rolls:Q'
y )
```

## Results

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