Log In  

Cart #53366 | 2018-06-08 | Code ▽ | Embed ▽ | No License
8

From Wikipedia:
In probability theory, the birthday problem or birthday paradox concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday. By the pigeonhole principle, the probability reaches 100% when the number of people reaches 367 (since there are only 366 possible birthdays, including February 29). However, 99.9% probability is reached with just 70 people, and 50% probability with 23 people.


Not sure why The Birthday Problem blows my mind, but it got under my skin today, and I just HAD to make a visual representation of it. Press [Z] to generate a birthday for each of the 70 cakes. Each cake is assigned a value between 1 and 366 (1 for each day of the year). If there are two matching birthdays, their candles light up! If you want to see it represented numerically instead of visually, press [X]!

P#53367 2018-06-08 00:33 ( Edited 2018-06-17 16:37)

Wow, I knew about the odds of there being no match got low rapidly as the sample size rose, but I didn't know it was already 1/1000 at 70 people.

Neat!

P#53368 2018-06-08 01:02 ( Edited 2018-06-08 05:02)

As an aside, you should allow the user to change the sample size, within a reasonable range.

P#53369 2018-06-08 01:04 ( Edited 2018-06-08 05:04)

Thanks for checking it out, Felice!

I'd considered adding the option to change the sample size, but the 70-person 99.9% probability was honestly the only representation that I cared to see. It just seemed like such a mind-boggling statistic that I wanted to make a program to see for myself if it was true. :P

P#53392 2018-06-08 17:02 ( Edited 2018-06-08 21:02)
2

:P I'll do it myself, then.

You can adjust the number from 0-96 now.

I also changed it so it color-codes the matches in reveal mode and makes the candles brighter for greater numbers of matches. Had to change the code/data structure a bunch for this, though.

There's also an easter egg. Hint: It's easiest with just two cakes, but I'll be impressed if anyone has the patience to do it with more.

Cart #53429 | 2018-06-09 | Code ▽ | Embed ▽ | No License
2

P#53422 2018-06-09 16:14 ( Edited 2018-06-09 21:18)

this is a cool visualization! probability is so crazy and unintuitive

lol @ Felice's easter egg XD (got it with 2 cakes)

P#53492 2018-06-12 01:46 ( Edited 2018-06-12 05:46)

Thanks kittenm4ster! :)

P#53632 2018-06-17 12:37 ( Edited 2018-06-17 16:37)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 17:43:02 | 0.013s | Q:26