Same birthday probability

Recently on Reddit I saw a Today I Learned post about the Birthday Problem. If you haven't heard of it, basically it says that if there are 23 people in the same room, the chance that two people share the same birthday is 50/50. I thought this was really interesting and decided that I wanted to test it out myself. Being a Monday night, I was just bored enough to do it.

I created a simple python script to run trials. I ran trials initially at 1000 trials per number of people, but eventually bumped this up to 10000 to smooth out my results.

When I ran this script, I got the following output for 10000 trials where P is the number of people, and Prob. is the percentage of trials with a matching birthday.

P       Prob.  
2       0.0024  
3       0.0093  
4       0.0165  
5       0.0263  
6       0.0424  
7       0.0574  
8       0.0738  
9       0.0923  
10      0.1181  
11      0.142  
12      0.1687  
13      0.1884  
14      0.2172  
15      0.246  
16      0.2853  
17      0.3193  
18      0.3391  
19      0.3696  
20      0.4125  
21      0.438  
22      0.4678  
23      0.5099  
24      0.528  
25      0.5574  
26      0.5903  
27      0.626  
28      0.6504  
29      0.6749  
30      0.6946  
31      0.7193  
32      0.7421  
33      0.7638  
34      0.7854  
35      0.8051  
36      0.8235  
37      0.8329  
38      0.8572  
39      0.8659  
40      0.8785  
41      0.8967  
42      0.9016  
43      0.9199  
44      0.9259  
45      0.9339  
46      0.942  
47      0.9485  
48      0.9536  
49      0.9612  
50      0.9621  
51      0.9704  
52      0.975  
53      0.9776  
54      0.9807  
55      0.985  
56      0.9867  
57      0.9872  
58      0.9895  
59      0.9913  
60      0.9931  
61      0.9928  
62      0.994  
63      0.9945  
64      0.9968  
65      0.9965  
66      0.9978  
67      0.9974  
68      0.9976  
69      0.9983  
70      0.9991  
71      0.9989  
72      0.9992  
73      0.999  
74      0.9999  
75      0.9997  
76      0.9998  
77      1.0  
78      0.9999  
79      1.0  
80      0.9999  
81      0.9996  
82      0.9999  
83      0.9999  
84      0.9998  
85      1.0  
86      1.0  
87      1.0  
88      0.9999  
89      1.0  
90      0.9999  
91      1.0  
92      1.0  
93      1.0  
94      1.0  
95      1.0  
96      1.0  
97      1.0  
98      1.0  
99      1.0  
100     1.0  

When visualized, this data looks like this:

Birthday Problem graph

I thought this was very interesting seeing that once you get 23 people in a room, the chances were actually 50/50. I didn't believe it. Also, once you get around 70 people in a room, you are almost guaranteed to have two people sharing a birthday. Cool!

The next time I'm at a party with more than 23 people, I'll definitely be thinking about this.