Coupon collector

FreeProbabilityEasyJane StreetSIGFive Rings

How many rolls of a fair NN-sided die are required, on average, to observe every face at least once? Compute the value for N=100N = 100, rounded to the nearest integer.

Solution

Coupon Collector's Problem

High-level idea. Decompose the total waiting time into independent geometric stages, then apply linearity of expectation.

Stage decomposition

Let TT be the total number of rolls of a fair NN-sided die needed to observe every face at least once. Define stage kk (k=1,…,Nk = 1, \ldots, N) as the period that begins the moment the (k−1)(k{-}1)-th distinct face was first seen and ends when the kk-th distinct face is first seen. Writing TkT_k for the number of rolls in stage kk,

T=T1+T2+⋯+TN.T = T_1 + T_2 + \cdots + T_N.

Distribution of each stage

At the start of stage kk, exactly k−1k-1 faces have been observed. Each roll independently reveals a previously unseen face with probability

pk=N−(k−1)N=N−k+1N.p_k = \frac{N-(k-1)}{N} = \frac{N-k+1}{N}.

Hence Tk∼Geometric⁡(pk)T_k \sim \operatorname{Geometric}(p_k) (number of trials until first success), so

E[Tk]=1pk=NN−k+1.E[T_k] = \frac{1}{p_k} = \frac{N}{N-k+1}.

Closed-form expected value

By linearity of expectation,

E[T]=∑k=1NNN−k+1.E[T] = \sum_{k=1}^{N} \frac{N}{N-k+1}.

Reindexing with j=N−k+1j = N-k+1 (as kk runs 1→N1 \to N, jj runs N→1N \to 1):

E[T]=N∑j=1N1j=N⋅HN,E[T] = N \sum_{j=1}^{N} \frac{1}{j} = N \cdot H_N,

where HN=∑j=1N1jH_N = \displaystyle\sum_{j=1}^{N} \frac{1}{j} is the NN-th harmonic number.

Numerical evaluation for N=100N = 100

Using the Euler–Maclaurin asymptotic expansion

HN=ln⁡N+γ+12N−112N2+1120N4−⋯ ,H_N = \ln N + \gamma + \frac{1}{2N} - \frac{1}{12N^2} + \frac{1}{120N^4} - \cdots,

with γ=0.57721566490153…\gamma = 0.57721566490153\ldots (Euler–Mascheroni constant):

H100≈4.60517018598809⏟ln⁡100+0.57721566490153⏟γ+0.00500000000000⏟1/200−0.00000833333⏟1/120000≈5.18737752.\begin{aligned} H_{100} &\approx \underbrace{4.60517018598809}_{\ln 100} + \underbrace{0.57721566490153}_{\gamma} + \underbrace{0.00500000000000}_{1/200} - \underbrace{0.00000833333}_{1/120000} \\ &\approx 5.18737752. \end{aligned}

Therefore,

E[T]∣N=100=100×H100≈518.74.E[T]\big|_{N=100} = 100 \times H_{100} \approx 518.74.

Rounded to the nearest integer:

519.\boxed{519}.

Related problems