Fresh out of college, you're throwing a huge party to celebrate with friends and family. Over 70 people have shown up, including your mildly eccentric Uncle Ted.
In one of his usual antics, he bets you £100 that at least two people in the room share the same birthday. That sounds ridiculous — there are many more possible birthdays than there are guests, so you confidently accept.
To your astonishment, after collecting the birthdays of just 32 guests, you've already found two guests that share the same birthday. Accepting your loss, you hand Uncle Ted his £100, but something feels off.
The next day, curiosity gets the better of you. A quick web search leads you to the birthday paradox, which reveals that with just 23 people, the probability of a shared birthday exceeds 50%.
Ah. So that's why Uncle Ted was so confident.
Determined to turn the tables, you start looking up other paradoxes; next time, you'll be the one making the bets.
The birthday paradox is a veridical paradox: even though it feels wrong, it is actually true.
Your task is to estimate the birthday paradox's probabilities.
To do this, you need to:
A birthdate includes the full date of birth (year, month, and day), whereas a birthday refers only to the month and day, which repeat each year. Two birthdates with the same month and day correspond to the same birthday.
The birthday paradox assumes that:
Your implementation must follow these assumptions.
Sign up to Exercism to learn and master C# with 62 concepts, 175 exercises, and real human mentoring, all for free.