Can You Track The Delirious Ducks?

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

The Riddler Football League (RFL) playoffs are upon us! As the coach, you’ve devised a new strategy for scoring after a touchdown. Your team will line up 2 yards away from the goal line in such a way that it could attempt either a 1-point conversion or a 2-point conversion. (Unlike other football leagues, the distance is the same for both types of conversion, and you need not announce which you’ll be attempting.) Your opponent can only properly defend against one of those two possibilities, so they’ll have to guess.

If you attempt a 1-point conversion and the other team defends against it properly, you’ll score 90 percent of the time. If they don’t defend it properly, you’ll score 100 percent of the time.

If you instead attempt a 2-point conversion and the other team defends against it properly, you’ll score 40 percent of the time. If they don’t defend it properly, you’ll score 60 percent of the time.

To tell your team which they should attempt, your team’s offensive coordinator will communicate to your team’s captain the probability with which they should attempt each. For example, the coordinator might say: “Go for 1 with a 51 percent chance, and go for 2 with a 49 percent chance.” Using a random number generator, the captain will then ultimately decide to go for 1 point or 2 points. (Naturally, every athlete in the RFL has a random number generator handy.)

However, given all the spying that occurs in the RFL these days, you can assume that the offensive coordinator’s message will also be heard by your opponent — that means the defense knows the exact probability with which you’ll attempt either conversion. Your opponent also knows the probability of you scoring in each of the four scenarios listed above.

With all that said, what strategy will maximize the average number of points you’ll score (i.e., how often should your team go for 1 or 2)? What should your opponent’s defensive strategy be? How many points will you score, on average, after each touchdown?

## Riddler Classic

After a long night of frivolous quackery, two delirious ducks are having a difficult time finding each other in their pond. The pond happens to contain a 3×3 grid of rocks.

Every minute, each duck randomly swims, independently of the other duck, from one rock to a neighboring rock in the 3×3 grid — up, down, left or right, but not diagonally. So if a duck is at the middle rock, it will next swim to one of the four side rocks with probability 1/4. From a side rock, it will swim to one of the two adjacent corner rocks or back to the middle rock, each with probability 1/3. And from a corner rock, it will swim to one of the two adjacent side rocks with probability 1/2.

If the ducks both start at the middle rock, then on average, how long will it take until they’re at the same rock again? (Of course, there’s a 1/4 chance that they’ll swim in the same direction after the first minute, in which case it would only take one minute for them to be at the same rock again. But it could take much longer, if they happen to keep missing each other.)

Extra credit: What if there are three or more ducks? If they all start in the middle rock, on average, how long will it take until they are all at the same rock again?

## Solution to last week’s Riddler Express

Congratulations to 👏 Nathan Holmes-King 👏 of Fremont, California, winner of last week’s recent Riddler Express.

Last week, you were asked to find a fraction (with a whole number numerator and denominator) that was greater than 1/2020, less than 1/2019 and with the smallest possible denominator.

Solver Amy Leblang used an algebraic approach, looking for a fraction a/b (where a and b are whole numbers) such that 1/2020 < a/b < 1/2019. Flipping all the fractions, you can rewrite this inequality as 2019 < b/a < 2020. Finally, multiplying through by a gives us 2019a < b < 2020a.

Again, our goal is to find the denominator b that’s as small as possible, and that will happen when a is also small. If we let a = 1, then there’s no whole number b that sits between 2019 and 2020, so that won’t work. But if a = 2, then we’re looking for a value of b between 4038 and 4040, which means b = 4039. Larger values of a will produce larger values of b, which this riddle wasn’t asking about. In other words, 2/4039 is the correct answer.

Many solvers, like Angela Zhou, observed that this question was straightforward if you knew a thing or two about Farey sequences, which are ordered sets of fractions between 0 and 1. For the Farey sequence in which all the denominators are at most 2020, the fractions 1/2020 and 1/2019 are “Farey neighbors,” meaning they’re next to right next to each other in the sequence. This riddle is effectively asking you to identify the first Farey sequence where 1/2020 and 1/2019 are no longer neighbors — that is, one where there’s another fraction between them. That fraction will be what’s called the mediant of the fractions on either side, generated by adding the numerators and the denominators: (1+1)/(2020+2019) = 2/4039.

Just to be extra sure that’s the right answer, solver Nolan Gannage wrote code to search all the fractions between 1/2020 and 1/2019 whose denominators were also 50,000 or less. Sure enough, the one with the smallest denominator was 2/4039.

That’s one of the Riddler maxims: “When in doubt, code it out.”

## Solution to last week’s Riddler Classic

Congratulations to 👏 Austin Calico 👏 of Ashland, Kentucky, winner of the last week’s Riddler Classic.

Last week, you looked at an alphanumeric code inspired by “Gematria,” where words were assigned numerical values based on their letters. Each A was worth 1 point, each B was worth 2 points, and so on. The value of a word was then the sum of the values of its letters. For example, RIDDLER had an alphanumeric value of 70, since R + I + D + D + L + E + R became 18 + 9 + 4 + 4 + 12 + 5 + 18 = 70.

But what about the values of different numbers themselves, spelled out as words? The number 1 (ONE) had an alphanumeric value of 15 + 14 + 5 = 34, and 2 (TWO) had an alphanumeric value of 20 + 23 + 15 = 58. Both of these values were bigger than the original numbers.

Meanwhile, if we looked at larger numbers, 1,417 (ONE THOUSAND FOUR HUNDRED SEVENTEEN) had an alphanumeric value of 379, while 3,140,275 (THREE MILLION ONE HUNDRED FORTY THOUSAND TWO HUNDRED SEVENTY FIVE) had an alphanumeric value of 718. These values were much smaller than the original numbers.

If we considered all the whole numbers that were less than their alphanumeric value, what was the largest of these numbers?

First off, this question was a little ambiguous. The intent was to find the largest number N that was less than its “Gematria score” of N, which we’ll call G(N) — that is, N < G(N). However, you could also have read the question as asking for the largest value of G(N) among numbers N where N < G(N). The majority of readers answered the first question, but we’ll address both here.

Almost all solvers wrote code for this one, with the general strategy of (1) systematically describing how numbers are codified as words in English, and (2) scoring those words. A few solvers, like Cameron Shelton, took the time to work it all out by hand. In the words of Cameron, this “gives me a better feel for the problem and because I enjoy it more.” Bravo, Cameron!

Either way, the answer turned out to be 279, or TWO HUNDRED SEVENTY NINE, which had a Gematria score of 284. To confirm this result, here’s a graph from solver Jason Ash showing the scores for the numbers from 1 to 500.

Sure enough, 279 is the last number above the dotted line, meaning it’s the greatest number to exceed its Gematria score. Interestingly, 80 is the smallest number that’s less than its Gematria score: EIGHTY is only worth 74 points. And for those of you who had the alternate interpretation of the original question, the number above the dotted line that’s worth the most points is 277, or TWO HUNDRED SEVENTY SEVEN, which is worth a whopping 307 points.

If you’re curious to see the scores of Gematria scores beyond those of the first 500 numbers, then solver Quoc Tran has an animation for you, showing the scores from ONE to ONE HUNDRED THOUSAND:

Finally, James Chapman took this riddle even further, solving it for multiple languages (not just English). James found that Finnish, French, and Polish each had answers just shy of 400. Dan Miller even went on to suggest using Roman numerals — maybe next time!

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

## Footnotes

1. Important small print: Please wait until Monday to publicly share your answers. In order to 👏 win 👏, I need to receive your correct answer before 11:59 p.m. Eastern time on Monday. Have a great weekend!

Zach Wissner-Gross leads development of math curriculum at Amplify Education and is FiveThirtyEight’s Riddler editor.