Problem. Each box contains one of equally likely coupons. How many boxes until you have all ?
Answer: . For , about boxes.
double couponExpected(int n) { double e = 0; for (int i = 1; i <= n; i++) e += (double)n / i; return e; } // n * H_n| Variant | Result |
|---|---|
| variance | |
| collect of the | |
| unequal probabilities | (inclusion–exclusion) |
| tail |
Proof: E = n H_n
Split the process into phases: phase () starts when distinct coupons are held and ends at the next new one. Each draw in phase is new with probability , so its length is geometric with mean . By linearity of expectation . Checked against a Monte Carlo simulation for .