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 2019*a* < *b* < 2020*a*.

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.