Expected number of cards

card-gamesprobability

Given a standard 52-card deck, what is the expected number of cards drawn (without replacement) before you get 4 of a kind (4 aces, 4 kings, etc.)

I tried to think of the problem from the perspective that the maximum number of cards that can be drawn before you get 4 of a kind is 40. From here I imagined 4 cards of a kind, with the 36 others being 3 cards of each of the 12 other kinds. I didn't specify the exact kind because I was looking for any kind. From here I thought of lining up all the cards in the deck, face-up, and applying vandermonde's to the possible arrangements of cards in front of the 4th card of the kind and using that to calculate probabilities for each number of cards drawn. The issue I was finding is that there is a lot of casework in determining all the possible permutations of cards before the 4th card is drawn.

Best Answer

A numerical solution, using Monte Carlo simulations (with Python) would be:

import numpy as np
import seaborn as sns
import pandas as pd
cards = np.concatenate([[i]*4 for i in range(1,14)])
def iteration(cards):
    drawn = {i:0 for i in range(1,14)}
    selected = np.random.choice(cards, len(cards), replace = False)
    count = 0
    while not max(drawn.values()) == 4:
        drawn[selected[count]]+=1
        count+=1
    return sum(drawn.values())
monte_carlo = pd.Series([iteration(cards) for i in range(100000)])
monte_carlo.describe()

Where I used 100.000 simulations. Some statistics of the distribution are:

count    100000.000000
mean         25.010640
std           5.822936
min           4.000000
25%          21.000000
50%          25.000000
75%          29.000000
max          40.000000
dtype: float64

And the simulations generate the histogram:

enter image description here

Related Question