What is the probability that with 100 people, there are 3 consecutive birthdays at some point in the year?

203 Views Asked by At

Assumptions:

  • $365$ days in the year.
  • All birthdays are equally likely.
  • The three consecutive days must fall within the same calendar year.

This was a fun problem that came up at my office of $100$ people when we had $3$ consecutive Birthdays. It's been a while since I've done a probability problem like this and I'm not feeling confident in the soundness of my approach.

My thoughts:

  • A. There are $363$ consecutive triples in a year since all days must fall within the same calendar year.
  • B. There are $100C3$ ways to select $3$ people to have consecutive Birthdays.
  • C. There are $3!$ ways to order those $3$ people.
  • D. There are $365^{97}$ ways the other $97$ people can have Birthdays.
  • E. There are $365^{100}$ ways $100$ people can have Birthdays.

Attempt: $P = (A * B * C * E) / D$

I seem to get muddled regarding what to do though. I'm getting confused about ordering in addition to combinations that have multiple sets of consecutive triples. From my research, I seem to think maybe I should be calculating the likelihood of not having any consecutive Birthdays, but that seems really difficult to count itself.

1

There are 1 best solutions below

3
On

This is difficult to compute exactly, for the reason you state. When we try to count the triples, we end up count the distribution more that once. If we count the ways the we can have people born on days $1$, $2$ and $3$, and add to the ways where people are born on days $7$, $8$, and $9$, we count the distribution where both events occur twice. Also, if a total of four people are born on days $1$, $2$, and $3$, we count that distribution twice.

One can try to use the principle of inclusion and exclusion to calculate this, but it's not practical, because of the large number of ways multiple events occur. Alternatively, we could try to compute the complementary probability: the probability that there are no three consecutive birthdays, but this suffers from the same kind of difficultly. We might end up selecting $100$ different days, no three of which are consecutive. If can compute that, there are $100!$ ways to distribute the people. But we might have only $95$ different days. Then we have to consider what the duplicate are like. Were $6$ people born on the same day? Or two on five different days? Or two people on three days and three on another? All these possibility require different calculations.

Unless I'm overlooking something, the most practical way to do this is by simulation. In a test with $100,000$ trials, I found $3$ consecutive birthdays $98.824\%$ of the time, so it's not at all unusual.

from random import choices

trials = 100000
count = 0
for _ in range(trials):
    birthdays = set(choices(range(365), k=100))
   
    for day in birthdays:
        if {(day+1)%365, (day+2)%365} <= birthdays:
            count += 1
            break

print(f'{count} successes in {trials} trials') 

produced the output

98824 successes in 100000 trials

I ran it again, without assuming that the birthdays must fall in the same day of the year. (Just remove the %365's in the test.) As expected it didn't make much difference. This time the output was

98876 successes in 100000 trials

so it appears that the probability is around $98\%$ either way.

EDIT

I should have said "just under $99\%$." I ran it again for the less restrictive case, and computed a $99.7\%$ confidence interval of $(.98789562,.98998438)$.