# Gummy Bears

I picked up a package of gummy bears which was called 12 Flavor Gummi Bears. On the back of the package, there was a statement:

DUE TO SIZE OF BAG,

MAY NOT CONTAIN

ALL 12 FLAVORS

That got me thinking: What was the probability that a given bag did contain all 12 flavors?

## Problem statement

Let’s first be clear what we’re asking. We’ll define the Gummy Bear Problem as follows:

A package has $n$ gummy bears. There are $m$ distinct flavors (or types) of gummy bears ($n \geq m$). What is the probability that a package has at least one of each flavor of gummy bear, i.e. that a package contains all possible flavors?

Assume that when gummy bears are put into the package, each flavor of gummy bear has the same probability of being chosen, and that the selection of one gummy bear has no impact on the selection of other gummy bears.

# Approach to the problem

There are at least two ways to approach this problem:

1. Numerical approximation: Run a simulation many times, and use the average results to come up with an approximation or estimate of the solution.
2. Analytical solution: Use some theory to come up with an expression that gives us the exact answer.

Let’s look at each.

The remainder of this post is covered in a Jupyter Notebook on GitHub.