Here are three questions for your weekend reflections. Number one: how many people would it take to build a human pyramid 22 layers tall? Number two: if 23 people in a room shake hands with everyone else exactly once, how many handshakes take place? Number three: what’s the chance that two of those 23 people have the same birthday? And the bonus: how are all of these questions connected?

First things first. Your pyramid has 22 brave Atlases on the bottom, carrying 21 people on their shoulders, 20 more balanced above, and so on and so on, up to the one lucky soul perched at the top. How many people make up this tower? Just add them up, row by row. 22+21+20+…+3+2+1.

Stop that hand drifting to your calculator—there’s a better way. As mathematical legend has it, child prodigy Carl Friedrich Gauss figured out a neat trick when he was just six years old. He decided to think about the numbers he was adding as if they were arranged in a long line, with 1 at the start and 22 at the other end. Now picture folding that line in half, so that 22 pairs with 1, 21 with 2, and so on until you reach 11 and 12, the kink in the middle. You can add numbers in any order, so add up each pair. The numbers make convenient partners—each pair sums to 23. You started out with 22 numbers, which gives 11 pairs, each equal to 23. You and clever little Gauss have made this problem much easier: 11x23 = 253. (That’s a lot of cheerleaders.)

One down, two to go. You’re in a room with 23 people, and everyone shakes hands with everyone else exactly once. How do we go about counting how many handshakes take place? Here’s one way: arrange everyone in a long, single-file line. Person 1, at one end, goes down the rest of the line, shaking the hand of every other person. At the other end of the line 22 handshakes later, Person 1 is done with handshake duties and leaves the room. Now Person 2 shakes the hand of everyone left. With Person 1 gone, that’s 21 handshakes. And we keep going, with everyone shaking the hand of each person behind them in line, until we have Person 23 at the end, bored to tears and swearing off recruiting events. How many handshakes is that? Well, Person 1 performed 22 handshakes, and Person 2, 21, and so on, until we had Person 22 and 23 at the end. A familiar sum: 22+21+20+…+3+2+1 = 253.

But that’s not the only way to slice up this problem. If everyone shakes hands with every other person exactly once, we can also think of handshakes occurring between every possible pair of people. How many pairs are there in a room of 23 people? We have 23 options for the first person and just 22 options for the second, since a person can’t shake their own hand. But handshakes are reciprocal; Romeo plus Juliet is the same as Juliet plus Romeo, which means we’ve double-counted our pairs. So our final number of pairs is this: 23x22/2 = 253. Mathematicians call this counting of pairs “23 choose 2.” We can count pairs for any number of n objects in the same way, which gives us the general formula for “n choose 2”: n(n-1)/2.

What do pyramids and handshakes have to do with birthdays? In a room of 23 people, the probability that two people share a birthday might seem low. There are 365 days! But as it turns out, the chances are pretty high—over 50 percent, in fact. It’s true that any specific pair of people has a low chance of sharing a birthday, just 1/365. But as we just found from our round of handshakes, there are 253 pairs of people in the room! That’s a lot of chances for an unlikely event to occur.

What’s really beautiful about math is how seemingly unrelated problems, like pyramids and birthdays, have deep and fundamental similarities. If you play with simple building blocks like “n choose 2” you will find many unexpected connections—and maybe even a shared birthday.