Here’s a fun puzzle: How big does a random group of people have to be to have a 50% chance that at least two of the people will share a birthday? The answer is 23, which surprises many people. How is it possible?

When pondering this question, known as the “birthday problem” or “birthday paradox” in statistics, many people intuitively guess 183, as it is half of all possible birthdays, as there are generally 365 days in a year. Unfortunately, intuition often gets along poorly with this type of statistical problem.

“I love these kinds of problems because they illustrate how humans are generally not good with probabilities, leading them to make bad decisions or draw wrong conclusions,” Jim Frost (opens in a new tab) , a statistician who has written three books on statistics and is a regular reporter for the American Society of Quality’s Statistics Digest, told Live Science in an email. “Plus, they show how useful they are mathematics it can be to improve our lives. So, the counterintuitive results of these problems are fun, but they also serve a purpose. “

To calculate the answer to the birthday problem, Frost started with some assumptions. First, she ignored it leap years , as this simplifies the math and does not change the results much. He also assumed that all birthdays had an equal chance of happening.

Related: Why does time fly when you have fun?

If you start with a group of two, the chance that the first person won’t share a birthday with the second is 364/365. Therefore, the probability that they will share a birthday is 1 minus (364/365) or a probability of about 0.27%.

If you hire a group of three, the first two people cover two dates. This means that the chance that the third person won’t share a birthday with the other two is 363/365. Therefore, the probability that everyone will share a birthday is 1 minus the product of (364/365) times (363/365) or a probability of about 0.82%.

The more people in a group, the greater the chance that at least a couple of people will share a birthday. With 23 people, there’s a 50.73 percent chance, Frost noted. With 57 people, there’s a 99% chance.

“I’ve received messages from college statistics professors that they’ll make a $ 20 bet on two people sharing a birthday in a particular statistics class,” Frost said. “Given the odds associated with the birthday problem, he knows he is pretty much sure of winning. But every semester the students always take the bet and lose! Luckily he says he pays back the money but then teaches them how to solve the birthday problem.”

There could be several reasons why the answer to the birthday problem seems counterintuitive. One is that people can subconsciously calculate what the chances are of someone else in a group having their birthday, as opposed to the real question, which is whether someone in a group shares a birthday, Frost said.

“Second, I think they also start with something along the lines of, well, there are 365 days in a year, so you probably need about 182 people for a 50% chance,” Frost said. “Most importantly, they significantly underestimate the rate at which probability increases with group size. The number of possible mating increases exponentially with group size. And humans are terrible when it comes to understanding exponential growth.”

The birthday problem is conceptually related to another problem of exponential growth, Frost noted. “In exchange for some service, suppose you are offered to be paid 1 cent on the first day, 2 cents on the second day, 4 cents on the third, 8 cents, 16 cents and so on, for 30 days,” Frost said. “Is that a good deal? Most people think it’s a bad deal, but thanks to exponential growth, you’ll have a total of $ 10.7 million on day 30.”

Originally published in Live Science.