Skip to main content
4 of 5
added 28 characters in body
rinspy
  • 3.4k
  • 16
  • 43

I think the solution would go something like this:

Let $P(m, n, k, x, y)$ be the probability of seeing exactly $x$ cards at least once over $k$ draws, once $y$ cards have already been seen.

Then $P(m, n, k, x, 0) = \sum_{i=0}^{n}P(m, n, k-1, x-i, 0) * P(m, n, 1, i, x-i)$

I think the possibilities under the sum sign are all unique, so we can sum them.

Your solution is then $P(m, n, k, m, 0)$. What is left is to define $P(m, n, 1, i, x-i)$ and we should be able to solve the problem recursively.

Edit: full solution in Python, implementing the method above:

import numpy as np
from scipy.special import comb
import matplotlib.pyplot as plt
m = 10
n = 4
def P(k, x, y):
    if k == 1:
        return (comb(m-y, x) * comb(y, n-x))/comb(m, n)
    else:
        prob = 0
        for i in range(x):
            prob += P(k-1, x-i, y) * P(1, i, y+x-i)
        return prob

def P_MC(k, x, y):
    sims = 10000
    good = 0
    for s in range(sims):
        ar = np.arange(m)
        seen = set(np.arange(y))
        for draw in range(k):
            np.random.shuffle(ar)
            for el in ar[:n]:
                seen.add(el)
        if len(seen) == (x+y):
            good += 1
    return good/sims

ests = []
acts = []
for k in range(1,16):
    ests.append(P_MC(k, m, 0))
    acts.append(P(k, m, 0))
    
plt.plot(range(1,16), ests)
plt.plot(range(1,16), acts)
plt.grid()
plt.legend(['Simulated', 'Actual'], loc='lower right')
rinspy
  • 3.4k
  • 16
  • 43