Coupon Collector Calculator
Estimate how many random draws you need to collect every item in a set, with the exact and approximate answers.
What it does
A cereal box contains one of n different coupons, chosen uniformly at random. How many boxes must you buy before you have the full set? This is the coupon collector problem, and its answer is larger than most people expect because the last few missing items are hard to find.
The trick is to break the wait into pieces. Once you hold k distinct coupons, the chance that the next box contains a new one is n minus k over n. The number of boxes until the next new coupon is a geometric random variable with expectation n over n minus k. Adding those expectations for k from zero to n minus one gives n times the sum of one over k from one to n, which is n times the nth harmonic number.
MIT OpenCourseWare lecture notes derive the result this way and get n Hn, noting that it grows on the order of n log n. The University of Texas randomized algorithms notes reach the same expression and add the variance. The same notes point out a memorable application: meeting at least one person born on each day of the year takes roughly 365 H365 draws.
For a set of ten items the harmonic number is about 2.929, so the expected draw count is about 29.29. Only ten of those draws are guaranteed to be distinct. The remaining 19.29 are the duplicates you should expect along the way, and most of them arrive near the end of the collection.
This page sums the harmonic series directly for an exact value within floating point precision, and also shows the common logarithm approximation n times ln n plus the Euler constant plus one half. The approximation is handy for large sets, but the exact sum is cheap to compute for the range this tool accepts.
How to use
- Enter the number of distinct items in the complete set.
- Read the expected number of draws needed to see every item at least once.
- Check the harmonic number that produced the result.
- Look at the extra draws figure to see how many duplicates to expect.
- Compare with the logarithm approximation, which is useful for large sets.
- Remember that this is an average over many trials, not a promise about any single attempt.
Formula
- n
- Number of distinct items in the set.
- Hn
- The nth harmonic number, the sum of reciprocals from 1 to n.
- E[X]
- Expected number of draws until every item has appeared.
- gamma
- Euler Mascheroni constant, about 0.577216.
The derivation uses the fact that the expected number of trials to get a success with probability p is 1 over p. When k distinct items are already held, the probability that the next draw is new is n minus k over n, so the expected wait for the next new item is n over n minus k. Summing those waits gives n times the harmonic number. The approximation adds the Euler constant and a correction of one half, and is accurate to one decimal place from about n equal to five upward.
Worked example
Example: a set of ten coupons
Default: n = 10 distinct items, each equally likely on every draw.
- The harmonic number is H10 = 1 + 1/2 + 1/3 + ... + 1/10 = 2.928968.
- Expected draws = n x Hn = 10 x 2.928968 = 29.28968, which rounds to 29.29.
- The number of draws that must be distinct is 10, so the expected duplicate count is 29.29 - 10 = 19.29.
- The logarithm approximation is 10 x (ln 10 + 0.577216) + 0.5 = 10 x 2.879801 + 0.5 = 29.30.
- The approximation lands within a hundredth of the exact sum at this size.
- Most duplicates arrive late: the last missing coupon alone takes about 10 draws on average.
- The tool shows 29.29, 2.9290, 19.29 and 29.30.
Reference table
| Items n | Harmonic number Hn | Expected draws n Hn | Duplicate draws |
|---|---|---|---|
| 1 | 1.0000 | 1.00 | 0.00 |
| 6 | 2.4500 | 14.70 | 8.70 |
| 10 | 2.9290 | 29.29 | 19.29 |
| 50 | 4.4992 | 224.96 | 174.96 |
| 365 | 6.4785 | 2,364.65 | 1,999.65 |
Limits
- Assumes every draw is independent and every item is equally likely.
- Assumes sampling with replacement, so the same item can appear many times.
- The expectation is an average. A single attempt can finish much earlier or much later.
- Unequal probabilities, limited packs or trading between collectors change the answer substantially.
Common mistakes
- Assuming the answer is just n, the number of items in the set.
- Using sampled items without replacement, which would guarantee completion in exactly n draws.
- Forgetting that the last item dominates the expected wait.
- Treating the logarithm approximation as exact for very small sets.
- Expecting a guarantee. The expected value describes the long run average, not a deadline.
Try it yourself
Quick checks. Answers sit tucked under each question.
A set of six items. How many draws are expected?
H6 = 2.45, so E = 6 x 2.45 = 14.70 draws. That is 8.70 draws beyond the six distinct items, and the log approximation gives 14.71.
How many people must you meet to cover all 365 birthdays, ignoring leap days?
H365 is about 6.4785, so E = 365 x 6.4785 = 2,364.65 people. The log approximation gives about 2,364.65 as well, since the correction terms are tiny at this size.
A set with one item only. What does the tool show?
H1 = 1.0000, so one draw is expected, with zero extra draws. The log approximation reads 1.08 because it is not intended for n = 1.
Questions
Why is the answer bigger than the number of items?
Random draws repeat. Once you have most of the set, most new draws are duplicates, and the wait for the final missing item can be long.
What is a harmonic number?
The sum of reciprocals of the first n positive integers. It grows like the natural logarithm of n.
Which draw takes the longest?
The last new item. When only one item is missing, the chance of drawing it is 1 over n, so the expected wait is n draws.
Is the formula exact?
The expectation n Hn is exact under the assumptions of equal probability and independent draws. The page computes the harmonic sum directly.
Does the order of draws matter?
Only the count of distinct items seen matters. The calculation groups draws by how many new types have appeared.
Can I use this for loot boxes or card packs?
Yes if each item is equally likely and packs contain one independent item. Rare item ratios or guaranteed slots need a different model.
Sources
- MIT OpenCourseWare 6.042 Lecture 22: Coupon Collecting
- University of Texas CS 388R Lecture 5: Coupon Collector and Balls and Bins