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.
From Daniel Kunigan, the sports sensation sweeping Riddler Nation:
Riddler Nation recently legalized sports betting, and of course everyone is excited to risk some cash on the national pastime: competitive coin flipping.
Every coin-flipping match is a faceoff between two teams. Each team selects a sequence of heads and/or tails to look for, and they simultaneously flip their own coin over and over until one team finds its sequence. If both teams find their sequences at the same time, they start over and flip until only team finds it. First to be the only team to have found its sequence wins.
You decide to get in on the action and go to one of these events. When you arrive, you see that the Red Team has chosen the sequence “heads-tails,” while the Blue Team has chosen “heads-heads.” You can get even odds on either team. Which team should you put your money on?
From Ken Rosenbaum, the only thing more fun than Nim is Random Nim (or is it Randnim?):
Acey and Deucy have mastered the game of Nim. They start with three heaps — one with three counters, one with four counters and one with five counters. They take turns choosing a heap and removing counters — at least one counter, but they can also take multiple counters or the whole heap. The player who takes the last counter from the last heap wins.
They have learned that if the first player takes two counters from the heap of three and plays perfectly thereafter, the first player will win. In fact, they have gone online and learned the simple way to use binary numbers to find the winning moves. Result: The game isn’t fun anymore.
But Acey, a compulsive gambler, has a suggestion: “Let’s start with heaps of random sizes! We’ll roll three dice and use those three numbers for the sizes of the heaps. To make it even more interesting, before we roll, let’s each bet a nickel that we’ll win. Since every starting position is either a win for the first player or for the second, and since the start is random, it must be a 50-50 chance.”
But it’s not a 50-50 chance. To make this random-start game actually fair, if Acey goes first, how much should Acey have to bet against Deucy’s nickel?
Extra credit: In a variation on the game, the player who takes the last counter loses instead of wins. How do the odds change under this version?
Extra, extra credit: What if they rolled two dice three times to get the initial sizes of the heaps?
Solution to last week’s Riddler Express
Congratulations to 👏 Bradley Dechant 👏 of Marshall, Minnesota, winner of last week’s Riddler Express!
Last week brought us to a trailhead by the side of the highway where Xavier and Yolanda agreed to do some hiking. The trail dead-ended a few miles in. Sounds fun enough. One problem was, though, that Yolanda hiked faster than Xavier, but neither of them knew exactly how fast either of them hiked, and they strongly preferred hiking at their own natural speed rather than adjusting to match the other. Another problem was that their phones were dead and they had no other way to tell time. How could these two hike such that they started at the same time, hiked only on the trail at their own speeds, and arrived back at the trailhead at the same time?
This puzzle’s submitter, Dave Moran, explains:
To guarantee they start together and get back to the trailhead at the same time, they agree that Yolanda will hike to the end of the trail and turn around and start back. When she encounters Xavier on her way back, both of them will turn around and go back the way they just came — Yolanda toward the dead end and Xavier toward the trailhead. Yolanda will reach the end of the trail again, turn around and head back to the trailhead, where she will just catch up with Xavier. If the trail has length L and they first meet up D distance from the dead end, then Xavier will have covered L-D at the time of the meeting and Yolanda will have covered L+D. And then Xavier will go L-D again on his way back to the trailhead and Yolanda will cover L+D again on her way back to the trailhead. The ratio of their speeds is then (L-D)/(L+D).
This solution is also quite practical, Dave added — you could organize a hike this way to satisfy hikers of very different speeds.
Solution to last week’s Riddler Classic
Congratulations to 👏 Michael Branicky 👏 of Lawrence, Kansas, winner of last week’s Riddler Classic!
Last week’s puzzle was a mathified version of the game played in the following delightful and viral video:
These were the rules: A team of kids stands at either end of some number of hoops. At the beginning, one kid from each end starts hopping at a speed of one hoop per second until they run into each other. At that point, they play rock-paper-scissors at a rate of one game per second until one of the kids wins. The loser goes back to their end of the hoops, a new kid immediately steps up at that end, and the winner and the new player hop until they run into each other. This process continues until someone reaches the opposing end, and that player’s team wins. If you, the gym teacher organizing this event, put down eight hoops, how long, on average, will the game last? How many hoops should you put down if you want an average game to last for an entire 30-minute gym class?
You can expect an eight-hoop game to last about 58.5 seconds. For a game to last an average of 30 minutes, you’ll need to put down 57 hoops.
This problem naturally lent itself to computer simulations (although a few solvers took some nice pencil-and-paper approaches, too, which I’ll get to in a minute). Solver Zack Segel provided his nicely annotated Python code, as did solvers Mike Richards and S.E.R. The basic idea here is to use the Monte Carlo method — have your computer “play” a whole bunch of these games to their completion, for various numbers of hoops, and keep track of the average number of seconds the games lasted. Once you’ve simulated, say, a few thousand of these games, you can take the average number of seconds, and that gives you a good guess as to how long you’d expect the game to take.
|Number of Hoops||Average time|
Using his sims, Zack found the average times for various numbers of hoops, as shown in the table. From there, he identified a general pattern. A one-hoop game takes 2.5 seconds. A two-hoop game takes 2.5 + 5 seconds. Three hoops takes 2.5 + 5 + 6. Four hoops takes 2.5 + 5 + 6 + 7. And so on. Extrapolating that pattern to our eight-hoop case, we can expect it to take 2.5 + 5 + 6 + 7 + 8 + 9 + 10 + 11, or 58.5 seconds, on average.
Extrapolating that pattern even further, adding more and more seconds for each hoop, we find that to get the sum to reach 30 minutes (1,800 seconds) would take 57 hoops.
Other solvers forwent the computer code altogether. Tim Black provided a lovely solution in which he noted that counting the kids’ discrete hops was rather annoying, so instead he introduced the idea of a firefly that flew continuously during the game. His basic graphical idea is shown below, and do see his solution for much more detail.
Using our assumptions, Tim wrote, the game shown in the video above is expected to take about 8:47.
Laurent Lessard also offered an excellent analytic solution, and at the end he plotted the amount of time the game would take for various numbers of hoops. Gym teachers of the world, you may be well served to print this out and laminate it.
Want to submit a riddle?
Email me at email@example.com.