For all possible contiguous 10 day periods within a single calendar year, what is the probability that at least one of the 10 day periods contains six birthdays if there are 60 birthdays randomly distributed within the year?

Trying to solve this quick little problem, think of this in general terms (ie don't take leap years, birth patterns into effect).

Unnecessary details: I did it via a program I wrote quickly and got a probability of .9446 over 10000 runs. However my boss(guy who gave me the problem) says that he got something around.09446 doing a similar solution a factor of ten off, I was wondering if anybody here could figure out a similar solution. Thanks

  • $\begingroup$ Do all the birthdays have to be on different days? $\endgroup$ – David Quinn Aug 21 '15 at 20:55
  • $\begingroup$ And do you mean at least one of the 10-day periods contains exactly 6 birthdays, or at least 6? $\endgroup$ – Michael Aug 21 '15 at 20:59
  • $\begingroup$ I get about $0.17$ (brute forse: generate all $10$-days periods, and $60$ random birthdays (some could fall on the same day) and calculate if any intersection of a $10$-day period and the set of the birthays has size greater or equal to $6$) $\endgroup$ – Antoine Aug 21 '15 at 21:03
  • $\begingroup$ If people can be born on the same day, and we look for cases of exactly 6, then the average number of 10-day periods with exactly 6 birthdays is: $$E[\mbox{num 10-day periods with exactly 6}] = 356 \underbrace{{60 \choose 6 } (10/365)^6(355/365)^{54}}_{.00472371} \approx 1.6816419276$$ $\endgroup$ – Michael Aug 21 '15 at 21:08
  • 1
    $\begingroup$ There's an ambiguity that greatly affects the answer, and different commenters are making different assumptions. If you're looking at all 10-day windows (there are 356 of these) the probability is around 1/2. If you're breaking up the year into disjoint 10-day windows (there are only 36 of these), then the probability is closer to 0.2. $\endgroup$ – Tad Aug 22 '15 at 2:50

To distinguish a factor of $10$ we can make the silly (but not far wrong) assumption that the chance any particular 10 day period has 6 birthdays is independent of any other period. We assume the birthdays are allowed to repeat dates. The chance that a particular 10 day period has exactly 6 birthdays is ${60 \choose 6}\left(\frac{10}{365}\right)^{6}\left(\frac{355}{365}\right)^{54}\approx 0.0047$ Adding in the chance of $7,8,9$ gets us to $0.00597$ Even if we only consider the 36 non-overlapping intervals of 10 days, the chance that none of them have at least 6 birthdays is $1-(1-0.00597)^{36} \approx 0.1939$ Of course, there is also the chance that the interval of 10 days that has 6 birthdays is from day 5 through day 14. I'm with you.

def f(n):
    ok = 0
    periods = [set(range(i, i+ 10)) for i in range(1, 356)] //10-day periods
    for _ in range(n):
        birthdays = set(randint(1,365) for i in range(60)) //60 b-days
        for x in periods:
            if len(x & birthdays) >= 6:                    //intersection
              ok += 1
    return ok / n

Call f(10**5) returned $0.1773$. This somehow contradicts the other answer. Is anything wrong with the code?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.