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 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

For this week’s Express, I present an apparent coincidence that has bothered me since 2015:

After being ambushed by the forces of the First Order on the planet Jakku, the droid BB-8 narrowly escaped and requires immediate help. Fortunately, there is one person (named Rey) on the planet who can help BB-8, but they’ve never met and BB-8 has no idea where Rey is located.

Even if BB-8 *did* know where Rey was, what’s the probability that BB-8 could reach her within 24 hours? Assume Jakku has a radius of 4,000 miles (similar to Earth) and that BB-8 rolls along at a speed of 3 miles per hour.

(Note: FiveThirtyEight is owned by Disney, which also owns BB-8, Jakku and whatever ramshackle hut Rey is hiding out in.)

## Riddler Classic

From Austin Chen comes a riddle of efficiently finding a song:

You have a playlist with exactly 100 tracks (i.e., songs), numbered 1 to 100. To go to another track, there are two buttons you can press: (1) “Next,” which will take you to the next track in the list or back to song 1 if you are currently on track 100, and (2) “Random,” which will take you to a track chosen uniformly from among the 100 tracks. Pressing “Random” can restart the track you’re already listening to — this will happen 1 percent of the time you press the “Random” button.

For example, if you started on track 73, and you pressed the buttons in the sequence “Random, Next, Random, Random, Next, Next, Random, Next,” you might get the following sequence of track numbers: 73, 30, 31, 67, 12, 13, 14, 89, 90. You always know the number of the track you’re currently listening to.

Your goal is to get to your favorite song (on track 42, of course) with as few button presses as possible. What should your general strategy be? Assuming you start on a random track, what is the average number of button presses you would need to make to reach your favorite song?

## Solution to last week’s Riddler Express

Congratulations to 👏 Kevin Winters 👏 of Rochester, New York, winner of last week’s Riddler Express.

The last edition of the Riddler posed a question about the World Series, in which one team hosts Games 1, 2, 6 and 7, while the other team hosts Games 3, 4 and 5. On average, the home team wins about 54 percent of the time. So then what was the probability that the home team would lose at least *six* consecutive games?

If we indicate a home win with an ‘H’ and a home loss (i.e., a road win) with an ‘R’, then you might think there are three ways the home team could lose at least six consecutive games out of seven total games: HRRRRRR, RRRRRRH and RRRRRRR. We can find the probability for each of these sequences by multiplying together 54 percent for each home win and 46 percent for each road win. The probabilities of HRRRRRR and RRRRRRH are each 0.512 percent, while the probability of RRRRRRR is a slightly smaller 0.436 percent.

But of course, as solver An Nguyen noted, this riddle has a twist. Let’s take a closer look at the sequence HRRRRRR, keeping in mind that one team will be the home team for Games 1 and 2 and then the road team in games 3, 4 and 5. After the first two games (HR in the sequence), the series will be even, with both teams having won one game apiece. After Games 3, 4 and 5 (RRR in the sequence), the original home team will now be ahead 4-1 in the series. In other words, the series is over — Games 6 and 7 will not be played, and there cannot be six consecutive road wins. Meanwhile, the other two sequences (RRRRRRH and RRRRRRR) indeed go to seven games, and so six road wins will occur. That means the answer is 0.512 percent plus 0.436 percent, or about **0.947 percent**. That’s less than a 1 in 100 chance of it happening — a once-in-a-century event!

For extra credit, you were asked to find the probability that the home team will lose at least five consecutive games, as well as four consecutive games. Just as with six consecutive games, the strategy is to list out the possibilities, making sure no team wins four games (and hence, the series) prematurely.

Sequences in which the home team loses at least five consecutive games include those in which it lost at least six consecutive games, as well as the following: HHRRRRR, RHRRRRR, HRRRRRH, RRRRRHH and RRRRRHR. Of these sequences, the first three don’t make it past Game 5. The last two end at Game 6, meaning they are technically one and the same sequence, RRRRRH, which has a probability of 1.112 percent. All together, the home team will lose at least five consecutive games 0.947 percent plus 1.112 percent, or about **2.06 percent** — a twice-in-a-century event.

To determine how often the home team loses at least four consecutive games, you must also consider the sequences HRHRRRR (which lasts seven games), RHHRRRR (which also lasts seven games), HRRRR (which lasts five games) and RRRRH (which can last different numbers of games, depending on what happens after Game 5). Taken together, the probability that the home team loses at least four consecutive games is about **8.1 percent**.

Just in case you were wondering, the math says there’s a 23 percent chance the home team will lose at least three consecutive games and a 61 percent chance the home team will lose at least twice in a row.

Finally, puzzle submitter Dave Moran compared these predicted rates with reality. According to Dave, there have been 95 World Series since MLB went to the 2-3-2 format in 1924 (remember, there was no World Series in 1994 due to a strike). Based on the probabilities calculated above, we’d expect there to have been one World Series with at least six straight road wins — sure enough, there was exactly one (2019). We also expect there to have been two World Series with least five straight road wins — sure enough, there were two (1996 and 2019). Finally, we’d expect eight World Series to have had at least four straight road wins — and, to no one’s surprise at this point, there were exactly eight (1926, 1934, 1941, 1949, 1961, 1986, 1996 and 2019).

Spooky!

## Solution to last week’s Riddler Classic

Congratulations to 👏 Joshua Goodman 👏 of Cambridge, Massachusetts, winner of last week’s Riddler Classic.

Last Riddler, five friends were playing the Riddler Lottery, in which they each chose exactly five numbers from 1 to 70. The first friend noticed that no number was selected by two or more friends. The second friend observed that all 25 selected numbers were composite (i.e., not prime and not 1). The third friend pointed out that each selected number has at least two distinct prime factors. The fourth friend remarked that the product of the selected numbers on each ticket was exactly the same. The fifth friend had nothing more to say. What was the product of the selected numbers on each ticket?

Solver Tim Thielke started by listing out all the numbers that met the criteria of the second and third friends (or really just the third friend, since having at least two distinct prime factors means a number *must* be composite). There are 41 numbers between 1 and 70 that have at least two distinct prime factors: 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, 26, 28, 30, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63, 65, 66, 68, 69 and 70. From this list, we somehow need to figure out which 25 numbers the friends chose.

Solver Maria Ilyukhina next looked at numbers that were multiples of large primes. (She also explained in her answer that it was her birthday — so happy birthday, Maria!) For example, suppose the product of the numbers on each of the five friends’ cards is divisible by 13. Looking carefully, you’ll see that only four of the numbers in the list above are divisible by 13: 26, 39, 52 and 65. So *at most four* of the friends’ products can be divisible by 13 — not all five. For the five products to be equal, that means *no one* chose a multiple of 13. The same goes for larger primes, like 17, 19 and 23. This leaves us with 28 numbers: 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, 28, 30, 33, 35, 36, 40, 42, 44, 45, 48, 50, 54, 55, 56, 60, 63, 66 and 70. We’re getting there!

Out of these 28 numbers, we need to pick the 25 that will be split into five groups of five numbers, each with the same product. If we were to multiply all 28 of these numbers together (it’s not entirely clear yet why we would do this, but bear with me), the product happens to be 2^{36}·3^{22}·5^{12}·7^{8}·11^{5}. Imagine splitting up these prime factors into the five groups. That’s easy for the five powers of 11 — one factor of 11 will go into each group. But dividing up the eight factors of 7 into five groups is trickier, because eight isn’t a multiple of five. We need to get rid of three of them, leaving us with five factors of 7, so that each group will get one of them.

And so, in going from 28 numbers down to 25, we need to remove three numbers so that the overall product of 2^{36}·3^{22}·5^{12}·7^{8}·11^{5} becomes 2^{35}·3^{20}·5^{10}·7^{5}·11^{5} — when every exponent is a multiple of 5, the prime factors are evenly distributable among the five groups. As James Barton explains in his writeup, the three numbers you must eliminate are 35, 63, and 70. Indeed, the 25 selected numbers are 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, 28, 30, 33, 36, 40, 42, 44, 45, 48, 50, 54, 55, 56, 60 and 66, and the product of the numbers on each ticket is 2^{7}·3^{4}·5^{2}·7^{1}·11^{1}, or **19,958,400**.

Now that we know the 25 numbers the friends picked, we’re ready for the extra credit: How many *different ways* could they have selected their numbers? This was challenging, as solver “Lenboy” attested, having submitted, “Jeezaloo. Not enough time in the day… someone can write a code…” as an answer.

It turns out there are many ways the friends could have selected their numbers. One example is: {6, 15, 56, 60, 66}, {10, 14, 48, 54, 55}, {12, 18, 42, 44, 50}, {20, 21, 33, 36, 40} and {22, 24, 28, 30, 45} — sure enough, the product of each group of five numbers is 19,958,400. Working together, solvers Boris Perkhounkov and David Zimmerman wrote some code to find the total number of unique ways you can form the 25 numbers so that each group of five has the same product. The answer turns out to be a whopping 12,781!

Finally, there are 5!, or 120, ways to assign these five groups to the five friends. Therefore, there are 12,781·120 = **1,533,720** total ways the friends could have picked their numbers so that their statements were all true. (Before you ask, yes, I also accepted 12,781 as a correct answer here.)

While that number is sizable, it’s still much, much smaller than the total number of ways the five friends could have chosen *any* five numbers. What I’m really saying is that these friends didn’t pick their numbers randomly. They were totally in cahoots.

## 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.