# birthday problem.

There's a famous probability exercise called the birthday problem. It's an interesting problem for sure, but typically it is calculating the wrong thing. In this series of videos we'll explore what this means.

**Notes**

The code that does all the simulation and plotting is listed below.

```
import numpy as np
import matplotlib.pylab as plt
def calculate(room = 20):
return 1 - np.prod((365 - np.arange(room))/365)
def simulate(room = 20, n_sim = 1000):
hit = 0
for i in range(n_sim):
n_bday = np.unique(np.random.randint(1, 365, room)).shape[0]
hit += n_bday == room
return 1 - hit/n_sim
plt.plot([calculate(r) for r in range(1, 35)], label="calculated")
plt.plot([simulate(r) for r in range(1, 35)], label="simulated")
plt.legend();
```

Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider getting the newsletter.