Welcome to The Riddler. Every week, I offer up problems related to the things we hold dear around here: math, logic and probability. There are two types: Riddler Express for those of you who want something bite-size and 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 next week’s column. If you need a hint or have a favorite puzzle collecting dust in your attic, find me on Twitter.

## Riddler Express

Let’s warm up with a bit of Yahtzee gameplay calculation:

Suppose that you’re playing a one-turn game of Yahtzee, in which your only consideration is maximizing your score on this single turn. (In Yahtzee, a player has up to three rolls of five dice to get various combinations of numbers, which earn the player different numbers of points.) After your second of three rolls, your five dice show 4, 4, 4, 5 and 5. You could keep all of your dice and score 25 points for a full house. Or you could reroll your 5s and try for the 50-point Yahtzee (which is when all five dice show the same number) — but then you’d run the risk of scoring a lowly three- or four-of-a-kind instead, which are worth the sum of your five dice.

What’s the best strategy for maximizing your expected score?

## Riddler Classic

From Zeke Steve, a puzzle inspired by a familial dispute over proper game night strategy:

It’s your final turn in a heated game of Yahtzee, and the only combination of dice you still need to score is a large straight (when all five dice show numbers in sequential order): You want your five dice to eventually show 1, 2, 3, 4 and 5 or 2, 3, 4, 5 and 6. On the first of your three possible rolls during your final turn, you roll 1, 2, 4, 5 and X (where X is not a 3). You could reroll the X in hopes of getting a 3. Or you could reroll the 1 and the X in hopes that they eventually land in some combination of 3 and 6. Or perhaps something completely different!

What’s the best strategy for hitting a large straight and winning the game?

## Solution to last week’s Riddler Express

Congratulations to 👏 Garan Geist 👏 of Chicago, winner of last week’s Riddler Express!

Last week, we met Andrea and Barry, both of whom exercised every day on their lunch hour on a path that runs alongside a parkway. Andrea walked north on the path at a steady 3 mph, while Barry biked south on the path at a consistent 15 mph. Each traveled in the same direction the whole time. The speed limit on the parkway is the same in both directions, and vehicle traffic flows smoothly in both directions, exactly at the speed limit. To pass the time while exercising, both Andrea and Barry counted the number of cars that passed them in both directions and kept daily statistics. After several months, Andrea mentioned that the ratio of the number of cars that passed her driving south to the number of cars that passed her driving north was 35-to-19. Barry said that for him, it was 1-to-1. What is the speed limit on the parkway?

It is **60 mph**.

There are two things that we don’t know when we sit down to solve this problem. One, of course, is the speed limit. The other is the relative number of cars that traveled north versus south. Let’s call the speed limit *V*, the northbound traffic flow *N*, and the southbound traffic flow *S*.

From Andrea’s perspective, the southbound cars passed her especially quickly because Andrea herself was traveling north. Specifically, Andrea observed cars passing her going south at the speed limit *plus *her own speed of 3 mph. The northbound cars, therefore, were passing her especially slowly, at the speed limit *minus* her own speed of 3 mph. Knowing that, we can represent Andrea’s observed ratio of southbound-to-northbound cars of 35-to-19 mathematically like so:

35/19 = ((*V* + 3)*S*) / ((*V* – 3)*N*)

From Barry’s perspective, the northbound cars were passing him especially quickly, because Barry himself was traveling south. The southbound cars, therefore, were passing him especially slowly. Specifically, Barry observed cars passing him going south at the speed limit *minus *his own speed of 15 mph and cars passing him going north at the speed limit *plus* his own speed of 15 mph. We can represent his ratio similarly:

1 = ((*V* – 15)*S*) / ((*V* + 15)*N*)

Lastly, we know that the traffic flowed smoothly in each direction, so that the “true” ratio of south- to northbound cars was the same for Andrea and Barry. Call that ratio *S/N* = *R*. Using that, we can rewrite the equations above slightly:

35/19 = ((*V* + 3) / (*V* – 3))*R*

1 = ((*V* – 15) / (*V* + 15))*R*

There are two solutions to this system of equations: one where *V* = 3/4 and *R *= -21/19 and one where *V *= 60 and *R* = 5/3. Only one of those is a reasonable speed limit, of course, so we know that the ratio of south- to northbound traffic is 5-to-3 and that the speed limit is 60 mph.

This is a simple example of the phenomenon known as the Doppler effect. Even though an ambulance’s siren makes a single sound, its pitch sounds different to you as it approaches you and then moves away from you. The same is true with Andrea and Barry. Even though the traffic flow is constant and smooth in both directions, it *appears* different to them as they move toward it in different directions.

## Solution to last week’s Riddler Classic

Congratulations to 👏 Daniel Upper 👏 of Corvallis, Oregon, winner of last week’s Riddler Classic!

Last week, you pondered a shuffled deck containing 13 cards. Each card had a number from 1 to 13 on it, and each number appeared on only one card. You looked at the number on the first card — suppose it was *k* — and then you reversed the order of the first *k* cards. You continued this procedure — reading the first card’s number and then reversing the order of the corresponding number of cards — until the first card read 1. What was the largest number of reversals that you might have had to do?

The largest number of reversals is **80**.

This problem was developed by the mathematician John Conway in the 1970s — he called it topswops. It’s essentially a programming problem and has garnered attention from prominent computer scientists including Donald Knuth. But it’s a *tough* programming problem. For the 13-card example, there are 13! = 6,227,020,800 decks you might need to consider. That’s manageable for a computer to search through, but if the deck starts to grow, the problem becomes unwieldy.

Solver Thad Beier animated one series of 80 reversals:

And Zach Wissner-Gross gave us another look at the process:

Adam Simon Chatterley, David Consiglio and Jay P. were kind enough to share their code. You can also find the answers for decks of various sizes in the On-Line Encyclopedia of Integer Sequences, but even that only goes up to a deck of 17 cards.

For extra credit, I asked what the maximum number of reversals was for a deck of 53 cards. That’s roughly possible decks, and the answer to this question is unknown. Thad estimated that his program wouldn’t finish for about a trillion years, and Chris Bergman answered simply “lol.” The best known lower bound on the true answer is 3,185, established in 2011 by Jarek Wroblewski during a three-month computer programming contest. Solver Hector Pefo offered the following proof that the answer is 4,012 — however it still awaits peer review.

## Want to submit a riddle?

Email me at oliver.roeder@fivethirtyeight.com.