Welcome to The Riddler. Every week, I offer up problems related to the things we hold dear around here: math, logic and probability. Two puzzles are presented each week: the Riddler Express for those of you who want something bite-size and the Riddler Classic for those of you in the slow-puzzle movement. Submit a correct answer for either,^{1} and you may get a shoutout in the next column. Please wait until Monday to publicly share your answers! If you need a hint or have a favorite puzzle collecting dust in your attic, find me on Twitter.

## Riddler Express

From Steven Anisman and Giacomo “Mike” Peccini comes a troublesome, triangular tribulation:

You have been tasked with painting a modern building that is shaped like a regular tetrahedron. When the building is viewed from above, the architect wants it to appear as four congruent equilateral triangles — one central blue triangle surrounded by three white triangles.

That means that three faces of the tetrahedron contain a blue kite, as shown in the animation below:

What is the measure of the smallest angle in this kite?

The solution to this Riddler Express can be found in the following column.

## Riddler Classic

This week’s Riddler Classic comes courtesy of George Mu, who is passing along a puzzle based on one discussed in a mock coding interview.^{2}

You are trying to whack a mole. Every second, it pops its head out from one of 100 holes arranged in a line. You don’t know where the mole starts, but you *do* know that it always moves from one hole to an adjacent hole each second. For example, if it pops out of the 47th hole, then one second later it pops out of either the 46th hole or the 48th hole. If it pops out of the first hole, then it’s guaranteed to pop out of the second hole next; similarly, if it pops out of the 100th hole, then it’s guaranteed to pop out of the 99th hole next.

Of course, there’s a catch — the mole is camouflaged, and you have no idea where it is at any time until you actually whack it. Each second, you can whack one hole of your choosing. Many sequences of whacks do not guarantee that you’ll eventually get the mole (e.g., always whacking the first hole), but some do.

What is the shortest such sequence that guarantees you will whack the mole, no matter where it starts or how it moves around? (In the aforementioned video, Ben and Dan discuss *a* sequence that is guaranteed to whack the mole, but it is not necessarily the shortest such sequence.)

The solution to this Riddler Classic can be found in the following column.

## Solution to last week’s Riddler Express

Congratulations to 👏 Christopher Halverson 👏 of St. Louis, Missouri, winner of last week’s Riddler Express.

Last week, my condo complex had a single elevator that served four stories: the garage (G), the first floor (1), the second floor (2) and the third floor (3). Unfortunately, the elevator was malfunctioning and stopping at every single floor, no matter what. The elevator always went G, 1, 2, 3, 2, 1, G, 1, 2, etc.

I wanted to board the elevator on a random floor (with all four floors being equally likely). As I rounded the corner to approach the elevator, I heard that its doors had closed, but I had no further information about which floor it was on or whether the elevator was going up or down. The doors might have just closed on my floor, for all I knew.

On average, how many stops would the elevator have made until it opened on my floor (including the stop on my floor)? For example, if I was waiting on the second floor, and I heard the doors closing on the garage level, then the elevator would have opened on my floor in two stops.

While I was equally likely to be on any of the four floors, the *elevator* was not. The repeating unit of the elevator’s cyclical motion was G-1-2-3-2-1. That meant it had a 1 in 6 chance of being in the garage going up, a 1 in 6 chance of being on the first floor going up, a 1 in 6 chance of being on the second floor going up, a 1 in 6 chance of being on the third floor going down, a 1 in 6 chance of being on the second floor going down and a 1 in 6 chance of being on the first floor going down.

Suppose I was on the garage level. If I heard the doors closing in the garage going up, I would have waited six stops. If the doors closed on the first floor going up, I would have waited five more stops. Working through all six cases, my average wait time would have been 3.5 stops (the average of the whole numbers from 1 to 6). If I was on the third floor, the average wait time would again have been 3.5 stops.

Now suppose I was on the first floor. If I heard the doors closing in the garage going up, I would have waited one stop. Had the doors closed on the first floor going up, I would have waited four stops (2-3-2-1). Had they closed on the second floor going up, I would have waited three stops (3-2-1). Had they closed on the third floor going down, I would have waited two stops (2-1). Had they closed on the second floor going down, I would have waited one stop (1). And had they closed on the first floor going down, I would have waited two stops (G-1). The average of *these* six cases was 13/6, or about 2.17. By symmetry, this wait time was the same had I been on the second floor. (I thought it was kind of neat that my average wait time was shortest on the two middle floors.)

My average wait was 3.5 stops half the time, while the other half the time it was 13/6 stops. Averaging these together, my expected wait was 17/6, or about **2.83 stops**.

For extra credit, my condo now had *N* floors instead of four. Once again, how many stops would the elevator have made, on average, until it opened on my floor? This time, the solution was a little more involved, requiring a number of summations. The answer turned out to be **(4***N***+1)/6**, which indeed gave you the correct solution when *N* was four. To see a complete derivation, check out the write-ups of solvers Jake Gacuan and Awang B. Brantas.

## Solution to last week’s Riddler Classic

Congratulations to 👏 Michael DeLyser 👏 of State College, Pennsylvania, winner of last week’s Riddler Classic.

Last week, you were the coach at Riddler Fencing Academy, where your three students were squaring off against a neighboring squad. Each of your students had a different probability of winning any given point in a match. The strongest fencer had a 75 percent chance of winning each point. The weakest had only a 25 percent chance of winning each point. The remaining fencer had a 50 percent probability of winning each point.

The match was a relay. First, one of your students faced off against an opponent. As soon as one of them reached a score of 15, they were both swapped out. Then, a different student of yours faced a different opponent, continuing from wherever the score left off. When one team reached 30, both fencers were swapped out. The remaining two fencers continued the relay until one team reached 45 points.

As the coach, you could choose the order in which your three students occupied the three positions in the relay: going first, second or third. How would you have ordered them? And then what were your team’s chances of winning the relay?

Solver Izumihara Ryoma realized that a good strategy had the strongest fencer going last. Remember, the player who went first could score at most 15 points before being subbed out, while the player who went last could win many more points. By this logic, if we labeled the three fencers “25,” “50” and “75” (based on their percent chance of scoring each point), you definitely wanted 75 to go last. So then was the optimal ordering 25-50-75, or was it 50-25-75?

One way to figure this out was to calculate the probability of victory for each ordering. The chart below shows all six orderings your team could have had. Each ordering corresponds to a grid of possible scores you could have seen during the relay, from 0-0 in the top left to 45-44 and 44-45 in the bottom right. To complete each grid, I started with a probability of 1 in the top left (the cell corresponding to a score of 0-0), and then split up this probability into two parts. One part, which represented *your* team scoring the next point, was added to the value of the cell directly below; the other part, which represented your opponent scoring the next point, was added to the cell directly to the right. Scores less likely to occur are darker, while likelier scores are lighter. You can see how much the ebb and flow of the match depended on the ordering:

For each grid, you could have computed your team’s precise chances of victory by summing the probabilities in the bottom row, which corresponded to winning scores from 45-0 through 45-44. Not surprisingly, having your weakest fencer go last was a terrible idea. With an ordering of 75-50-25, you won 6.8 percent of the time. Switching those first two fencers wasn’t much better, marginally increasing your chances to 7.5 percent.

Having your middle fencer go last led to diverging results. With an ordering of 75-25-50, your chances of winning were 17.4 percent. Meanwhile, 25-75-50 gave you an 82.6 percent chance of winning. In the latter case, your strongest fencer could dig your team out of the hole created by your weakest fencer, allowing your middle fencer to hopefully maintain that lead.

Sure enough, your best bet was to have your strongest fencer go last. And while an ordering of 50-25-75 gave you a 92.5 percent chance of winning, your best strategy was to order your team from weakest to strongest, **25-50-75**, which gave you a **93.2 percent** chance of victory. (You may have noticed that these six probabilities from the six orderings formed three pairs that each added up to 100 percent. Why? Symmetry!)

By the way, a few years — *cough, decades* — ago, I saw this riddle play out before my very eyes. I was in the stands at a Long Island fencing tournament, watching two teams face off in a relay to 45 points. Over the first two rounds, one team jumped out to a 30-15 lead. And so, to win the relay, the final fencer on the trailing team had to earn 30 points while keeping his opponent to fewer than 15. And that’s exactly what he did. Needless to say, the gymnasium went wild.

## Want more riddles?

Well, aren’t you lucky? There’s a whole book full of the best puzzles from this column and some never-before-seen head-scratchers. It’s called “The Riddler,” and it’s in stores now!

## Want to submit a riddle?

Email Zach Wissner-Gross at riddlercolumn@gmail.com.