# How many days are needed to cover at least half of all birthdays in a group of people?

My question is related to this question.

I am wondering if we have a large crowd of $2000$ people: what is the expected minimum number days of the year we have to pick in order for at least half of the birthdays of the crowd to be in one of those days?

To be clear: with $2000$ people the average number of birthdays for any day is between $5$ and $6$, but there surely will be days where $10$ or even $12$ people have their birthday. So, knowing the birthdays of all people, I want to pick as many of those days, so that with as few days as possible I do cover half of the birthdays. That should be a good bit below $183$ I would think.

In fact, my intuition is that for a crowd of $2000$, this would be $100$ or so, but I could be way off, so I would like to know.

I also have the feeling that with a crowd of this size, we can make a fairly precise prediction as to how many days are needed. That is, if the expected number of days we need to cover at least $1000$ of the $2000$ birthdays is $100$, I would guess that the actual number of days with an actual crowd will be fairly close that that expected number. That is, I would like to have a result that says something like: There is a $95$% chance that the actual number of days lies within the interval $[X-Y,X+Y]$.

I am just guessing: $X=100$ and $Y=5$

How far am I off?

I welcome any kind of mathematical analysis, but I also welcome computer simulated approximations for this. And of course, while I am particularly interested in a crowd size of $2000$, feel free to provide a general answer in terms of $n$.

• If you covered the first half of the year, you would have covered half the birthdays, so X is 182.5, and the interval is distributed around that. – Mike Jun 29 '17 at 20:23
• @Bill The answer is no greater than 183. 183 days guarantees half of the birthdays but given a random sample distributed between 365 birthdays we expect to find some days which are more common by chance. – Hugh Jun 29 '17 at 20:27
• @Hugh There is no guarantee that 183 days is sufficient, in fact, if we get a crowd of 2000 people born on 31 december and pick the first 364 days we haven't even covered a single birthday. This is very unprobable in a uniform distribution, but definitely a possibility. – orlp Jun 29 '17 at 20:28
• @Bill Right, what Hugh says: with 2000 people the average number of birthdays for any day is a between 5 and 6, but there surely will be days where 10 or 12 people have their birthday. So, I want to pick as many of those days, so that with as few days as possible I do cover half of the birthdays. That should be a good bit below 180 I would think. – Bram28 Jun 29 '17 at 20:30
• @hugh Ah, so the problem is that we assume that given a multiset $B$ of uniformly random chosen integers $b \in \{1, \dots, 365\}$ we optimally choose set $S$ such that $|S \cap B| \geq \dfrac{1}{2}|B|$, then what is the expected value of $|S|$? – orlp Jun 29 '17 at 20:37

From computer simulation it would seem that 124-125 days is the expected number of days required.

My Python 2.7 code is here on pastebin. If you want to use it you can change the number of people with birthdays from 2000 to something else. Also you can change the sample size but 1000 samples seems to give a narrow confidence interval suggesting that the simulation is accurate.

I have repeated this test for a range of number of birthdays up to 10000. I graphed how many days are required to cover at least half of all birthdays (Note the logarithmic scale).

For a small number of birthdays the average number of days required is pretty much half of the number of birthdays.

For "medium" number of birthdays it appears that there is relationship like $\text{[Average Days Required]} = a + b\log(\text{[Number Birthdays]})$

However, this relationship can't hold for larger numbers of birthdays because the average days required can't go above 183.

I don't show the variances in the graph but one interesting observation is that the variance peaks at around 183 birthdays

• Thank you!! i'll try and play with the coded myself for a bit. So how often would you say that the number is between 120 and 130? – Bram28 Jun 30 '17 at 1:03
• @Bram28 The mean is 124.8 and the variance is 5 days. If you assume the number of days has a normal distribution then 97% of the time the number of days required is in the range 120-130 – Hugh Jun 30 '17 at 7:23
• Aha! So I was a good bit off with my guess on $X$, but my guess on $Y$ was pretty good :). Thanks a lot for your help! – Bram28 Jun 30 '17 at 9:30