# How many (hypothetical) packs do I need to get every card in a set?

## The Question

Let's say a hypothetical company makes trading cards. There are 50 unique cards, and you can the cards in packs of 5. Cards don't repeat within a pack. There's no rarity and their packing methods are perfect, so the cards are evenly distributed.

How many packs would I need to buy for a 95% chance of getting a complete set (at least 1 of each card)?

### My Guesses

I found this page, which has the formula for the number of packs I'd need to open to get a given card with 90% certainty. I plugged that back into the ln(1-chance)/ln(1-odds) to get the odds of that happening for every card, but I'm not sure that's the right approach.

Thanks a bunch!

• Related Wikipedia article – Arthur Aug 22 '17 at 21:49
• Related to the coupon-collector-problem, but more difficult because we get $5$ distinct cards in every trial. – Peter Aug 22 '17 at 21:57

Let's say you buy $T$ packs of 5 cards each. We would like to know the probability that you have a complete set of 50.

We define an "outcome" to consist of a sequence of $T$ sets of 5 cards each. Then there are $N = \binom{50}{5}^T$ possible outcomes, all of which we assume are equally likely. We want to count the number of outcomes in which we have all 50 possible cards. We will do this by use of the Principle of Inclusion and Exclusion (PIE). To that end, let's say an outcome has "Property $i$" if card $i$ is missing, for $i = 1, 2, 3, \dots , 50$. Let $S_j$ be the number of outcomes with $j$ of the properties, for $j = 1,2,3, \dots ,50$. Then \begin{align} S_1 &= \binom{50}{1} \binom{49}{5}^T \\ S_2 &= \binom{50}{2} \binom{48}{5}^T \\ &\dots \\ S_j &= \binom{50}{j} \binom{50-j}{5}^T \\ &\dots \\ S_{50} &= 0 \end{align}

By PIE, the number of outcomes with none of the properties, i.e. with no missing cards, is $$N_0 = N - S_1 + S_2 - S_3 + \dots +S_{50}$$ and the probability of this event is $$P(T) = \frac{N_0}{N}$$

For numerical results, we find the smallest number of packs we need to buy to have a 0.95 probability of success is 66, with $P(66) \approx 0.953201$, and the probability of success when we buy 10 packs is $P(10) \approx 0.0958077$.

Let $s$ be the number of cards. Buying $k$ cans of $m$ distinct cards can be done in

$$\binom{s}{m}^k$$

ways.

To count how many of these that fails to contain all cards, count first those that miss card $1$. Next count those that miss card $2$ but contain $1$. Then those that miss $3$ but contain $1$ and $2$, etc... Adding these counts up gives the total amount of possible unsuccessful draws.

The formula for this uses inclusion/exclusion (inner sum). The index $i$ correspond to counting those without card $i+1$

$$\sum _{i=0}^{s-1} \sum _{j=0}^i (-1)^j \binom{i}{j} \binom{s-1-j}{m}^k$$

$j=0$ counts how many cases there are with card $i+1$ missing. $j=1$ subtract those cases where, in addition, one or more of the cards that must be contained is/are missing. $j=2$ adds those cases where, in addition, two or more of the cards that must be contained is/are missing, etc...

In your case $k=66$ happens to be the smallest value such that $5\%$ or less cases are unsuccessful.

• Got it! That's really cool. Small follow up question: if I were to buy 30 packs, what are the odds I'd get at least one of each card? – xavdid Aug 22 '17 at 22:55
• @xavdid The odds become 0.1059593923, because there are 580568190170876751886602781732622222892838627136366784770895634350089663599242541085466236626876539079199644156331824652247230364512834810387675541427436571541277480770316516325767450572800 cases that contain all cards, and there are 6059725609153368357960547624287212462949877780017577791761063804354987084823290045884769716440369810573995303968262121144227052161329051647932909080291758309376000000000000000000000000000000 cases in total. – Coolwater Aug 22 '17 at 23:00
• got it. thanks for the explanation! – xavdid Aug 23 '17 at 0:22