Premium problem83. Birthday Collision

Easy Locked

n people each have a birthday drawn uniformly from d equally likely days. Return the probability that at least two of them share one.

Go through the complement and place people one at a time: the second person must avoid 1 day, the third must avoid 2, and so on.

P(collision)=1−∏i=0n−1d−idP(\text{collision}) = 1 - \prod_{i=0}^{n-1}\frac{d-i}{d}

Input

n = 23
d = 365

Output

0.5072972343239857

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)