Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Created January 31, 2020 20:45
Show Gist options
  • Save loisaidasam/549dff520e1c25abe4d0150d52b6d49f to your computer and use it in GitHub Desktop.
Save loisaidasam/549dff520e1c25abe4d0150d52b6d49f to your computer and use it in GitHub Desktop.
How often can we celebrate someone's birthday in the office?

Given a certain amount of employees in an office, how many weeks of the year should it be reasonable to celebrate birthdays?

Assumptions:

  • there are ~200 employees in this office
  • there are 52 weeks in the year
  • there is an equal probability of each employee being born on any of the 52 weeks

Here are 20 trials:

In [23]: for epoch in range(20): 
    ...:     birthdays = set() 
    ...:     for employee in range(200): 
    ...:         birthdays.add(random.randint(1, 52)) 
    ...:     print(len(birthdays)) 
    ...:                                                                                            
52
50
51
51
51
51
51
50
51
49
50
51
52
49
51
52
51
52
51
48

Looks like we should be celebrating roughly every week 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment