aez-notes

Finding Your Birthmate

You want to find someone whose birthday matches yours. What is the least number of strangers whose birthdays you need to ask about to have a 50-50 chance?

Each person presents a Bernoulli trial with probability of success 1/365, so the number of failures until the first success follows a geometric distribution.

load(distrib)$

/* prob n-th person shares birthday */
prob_success_on(n) := cdf_geometric(n - 1, 1/365);

for n:250 step 1 thru 255 do {
  print([n,float(prob_success_on(n))])
};

So the solution is 253.

[250, 0.4963488868538334]
[251, 0.4977287529172476]
[252, 0.4991048385256935]
[253, 0.500477154036582]
[254, 0.5018457097789476]
[255, 0.5032105160535259]

Author: Alex Zarebski

Created: 2022-04-15 Fri 12:29

Validate