Premium problem84. How Many People Until a Collision Is Likely

Medium Locked

Return the smallest number of people for which the probability of a shared birthday exceeds threshold, given d equally likely days.

Count upwards, shrinking the no-collision probability by one factor at a time, and stop the moment you cross. For d = 365 and a threshold of 0.5 the answer is famously smaller than people guess.

Input

threshold = 0.5
d = 365

Output

23

Premium problem

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

Implement solve(...)