Skip to content

Instantly share code, notes, and snippets.

const CellTypes= Object.freeze({
EMPTY: 0,
RUPOOR: 1,
BOMB: 2,
});
const SimplifiedCellTypes = Object.freeze({
EMPTY: 0,
BAD: 1, // RUPOOR or BOMB
});
@nhulbert
nhulbert / counting_unique_coupons.md
Last active February 12, 2023 03:36 — forked from bsidhom/counting_unique_coupons.md
Compute the distribution of unique (equi-probable) coupons given a fixed number of draws

test Let $a(n,k,p)={n \choose p}{k \brace p}p!$ for which the generating function is $A(x,y,z) = \displaystyle\sum_{n,k,p \geq 1}{a(n,k,p)x^ny^kz^p}$

Suppose that you have a pool of n different types of coupons (one of each) and want to sample k coupons with replacement. What is the distribution of the random variable X, which counts the number of distinct coupons observed with each k-sized sample? I was unable to come up with a closed-form solution on my own, instead resorting to simulation and brute force. This captures a solution I was able to find by searching online and putting the pieces together. I've written the equations below in approximate Wolfram language syntax, since math typesetting is not available.