Can You Defeat A Troll With Your Calculator?
The Riddler
By Zach Wissner-Gross
Jun. 9, 2023, at 8:00 AM
Illustration by Guillaume Kurkdjian
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 the next column. Please wait until Monday to publicly share your answers! If you need a hint or have a favorite puzzle collecting dust in your attic, find me on Twitter or send me an email.
Friday, June 30 will mark the final column for The Riddler here at FiveThirtyEight. If my math is right, there have been 375 columns (this being the 376th) over the past eight years, four under the stewardship of Oliver Roeder and another four under mine. Every moment has been an absolute pleasure, from reading (and attempting to solve) submitter's puzzles, writing a few puzzles of my own, and especially marveling at the creative solutions and collaborations throughout Riddler Nation.
But this isn't quite the end. On Friday, June 23 I will be running the Eighth and Final Battle for Riddler Nation, with results appearing in the ultimate column the following week. And after that … stay tuned!
If you’d like more weekly puzzles in math, logic and probability (and occasionally geometry, physics and beyond), please consider taking a one-minute survey that will help me plan some of my next steps:
Take the survey
And now, without further ado, back to the puzzles!
From Tim Curwick comes a puzzle of pointers:
RECOMMENDED
Politics
How Other Candidates Are Reacting To Trump's Federal Indictment
Read Now
Recommended
How Other Candidates Are Reacting To Trump's Federal Indictment
Emergency Podcast: Trump's Indictment, The Sequel
Trump's First Indictment Didn't Hurt Him Politically. The Second Could Be Different.
You’re a mission commander for the Riddler Space Agency, which is engaged in a space race with a competing agency. Both agencies are trying to claim regions of a newly discovered, perfectly spherical moon that possesses a magnetic field. Everywhere on the surface of this moon the magnetic field lines point from the north pole to the south pole, parallel to the surface (i.e., the magnetic field does not point into or out of the moon's volume).
While your team will reach the moon first, the politicians in charge have entered into a rather bizarre agreement. Wherever your team lands on the moon, all the points on the surface whose magnetic field lines point in the direction of your landing site — that is, where the magnetic field points more toward your landing site than away from it — will belong to Riddler Nation. All the remaining parts of the surface will go to the competing agency's nation.
If your team lands on a random point on this moon's surface, then what is the expected fraction of the moon's surface area that will be claimed by Riddler Nation?
Submit your answer
While crossing a bridge one day, you find yourself stopped by a troll. The troll will grant you passage to the other side, provided you can estimate the factorial of a number N. (The troll kindly reminds you that the factorial — written with an exclamation point — of a whole number is the product of all the whole numbers from 1 to that number. For example, 5! is the product of the whole numbers from 1 to 5, so it's 120.)
That's no problem, you think, as you whip your calculator out of your pocket. In addition to the 10 digits and a decimal point, your calculator can add, subtract, multiply, divide and exponentiate. And it even has a factorial button. Or rather, it used to …
It appears that the devious troll somehow magically removed the factorial button from your calculator, replacing it with a button labeled N, which loads the value of N from the calculator's memory whenever you press it. The troll has not revealed to you the precise value of N, even though your calculator knows what it is, but you do know that N is no more than 200.
To pass the bridge, you must use your calculator to estimate N! to within two orders of magnitude — that is, your answer must be within a factor of 100 of the exact value of N!.
What expression will you type into your calculator?
Submit your answer
Congratulations to 👏 Aaron L. 👏 of Houston, winner of last week's Riddler Express.
Last week, you were betting on a horse race at The Riddler Casino. The casino provided betting odds (in the American format) for each horse. For example, odds of -150 meant that for every $150 you bet, you won an additional $100. Meanwhile, odds of +150 meant that for every $100 you bet, you won an additional $150.
Now, to break even, a horse with -150 odds should win 60 percent of the time, while a horse with +150 odds should win 40 percent of the time. (Yes, both +100 and -100 correspond to a 50 percent chance of victory.) Of course, most casinos rig the odds such that betting on all the horses in a race would cause you to lose money.
But not The Riddler Casino! Here, a horse with -150 odds has exactly a 60 percent chance of winning, and a horse with +150 odds has exactly a 40 percent chance.
And so, last week, a five-horse race caught your eye. The odds for three of the horses were +100, +300 and +400. You couldn't quite make out the odds for the last two horses, but you could see that they were both positive multiples of a hundred. What were the highest possible odds one of those last two horses could have had?
Since you knew The Riddler Casino offered fair odds, you could convert the odds of the first three horses directly into probabilities. The first horse had odds of +100, which meant for every $100 you bet, you won an additional $100. For the odds to be fair, this horse's probability of winning had to be 1/2. The second horse had odds of +300, which meant its probability of winning was 1/4. The third horse had odds of +400, which meant its probability of winning was 1/5. In general, positive odds that are 100 times x corresponded to a probability of 1/(x+1).
You further knew that one of the five horses had to win, which meant their probabilities had to add to 1. The first three horses accounted for a collective probability of 1/2 + 1/4 + 1/5, or 19/20. That meant the last two horses had a combined 1-in-20 chance of winning. But what were their individual chances?
We already said that positive odds of 100 times x corresponded to a probability of 1/(x+1). So when x was a whole number, as you were told was the case for those last two horses, that meant the probability was a unit fraction (i.e., a fraction with a numerator of 1). This meant the last two horses had probabilities that could be written as 1/a and 1/b, where a and b were whole numbers and 1/a + 1/b = 1/20.
The puzzle was specifically asking for the highest possible odds for one of those last two horses, so you wanted to minimize one of those two probabilities, say, 1/b. You could minimize 1/b by maximizing 1/a, and the largest unit fraction less than 1/20 was 1/21. Setting a equal to 21 gave you 1/b = 1/20 − 1/21, which meant 1/b = 1/420, which was indeed the smallest possible unit fraction you could generate. (Equivalently, as recognized by solver Bowen Kerins, 1/420 was a value that was clearly associated with the highest odds.)
The last step was converting this probability back to betting odds. The last two horses had odds of +2,000 (for the horse with probability 1/21) and +41,900 (for the horse with probability 1/420).
Congratulations to 👏 Adam Richardson 👏 of Old Hickory, Tennessee, winner of last week's Riddler Classic.
Last week, in a game show, there were three identical doors arranged in a row from left to right. The host of the show, "Monty," chose one of the doors and placed a prize of $100 dollars behind it. There was no prize behind the other two doors. You were not present when Monty chose the door and placed the money behind it, so you couldn't say for certain which door the prize is behind.
You were then brought to the stage and required to select one of the three doors to open. If the prize money was behind it, then you won! But if you guessed incorrectly, all was not lost. You could pay $80 to pick a second door. However, before you made that second selection (but after you paid the $80), Monty would give you a hint, telling you whether the prize was behind a door that was to the left or to the right of your first choice. (Note that this hint was only helpful when you previously selected the middle door.) If the prize wasn't behind that second door, you could pay another $80 to try a third time.
You could assume that both you and Monty played with optimal strategies — you to maximize your expected net earnings (prize winnings minus payments for hints), and Monty to minimize the same. How much net earnings could you have expected to make on average?
You might have thought that you should have opened the middle door first. If the prize was behind it, then you won $100 without paying a cent, which was great! But if the prize wasn't behind the middle door, then you could pay $80 for a hint and another pick. Of course, that hint told you exactly where the prize was, since there was only one door to the left of the middle and one door to the right. After paying the $80, you were guaranteed to win $100 with your next selection. And so, with this strategy, you either won $100 outright or you made a profit of $20.
Now, had Monty been onto your strategy, he would definitely have placed the prize behind one of the two side doors rather than the middle, which meant you never actually won the $100 and instead made only $20. So rather than always pick the middle door first, it was worth exploring a mixed strategy, whereby you sometimes picked the middle door and other times picked a side door. Monty would likely do the same. And with a two-player mixed strategy contest, this puzzle comfortably fell within the realm of game theory.
Suppose you picked the middle door with probability p and each side door with probability (1−p)/2. Meanwhile, suppose Monty placed the prize behind the middle door with probability a and a side door with probability q and each side door with probability (1−q)/2. What were your expected winnings, in terms of p and q?
Your chances of picking the prize door outright — whether it was the middle door or a side door — were pq + (1−p)(1−q)/2, in which case you won $100. If you picked the middle door first but were incorrect, which occurred with probability p(1−q), the hint ensured you always guessed correctly on your next attempt, which meant your net winnings were $20. If you picked a side door but were incorrect, which occurred with probability (1−p)q + (1−p)(1−q)/2, you still had two doors that potentially hid the prize, and it turned out to not be worthwhile to play further, meaning you walked away with no net profit or loss.
Putting these results together, your expected winnings in dollars were 100pq + 100(1−p)(1−q)/2 + 20p(1−q), which simplified to 50 − 30p − 50q + 130pq. It turned out that this game had a unique Nash equilibrium, which was plotted by solver Rohan Lewis below:
To analytically solve for this equilibrium, you could analyze how that previous expression varied with p and q. For any value of q (i.e., no matter what Monty's strategy was), a particular value of p always resulted in maximum expected winnings. To compute that value, you could take the partial derivative with respect to q to get 130p − 50. Setting this equal to zero gave you the optimal value of p (for you), which was 5/13. Similarly, taking the partial derivative with respect to p gave you the expression 130q − 30, and setting this to zero gave you the optimal value of q (for Monty), which was 3/13.
With the game theory done, here's how things played out: Monty placed the prize behind the middle door with probability 3/13 and behind each of the two side doors with probability 5/13. Then, you picked the middle door with probability 5/13 and each of the two side doors with probability 4/13. All this made intuitive sense — you were more likely to pick the middle door than either of the sides, whereas Monty favored the side doors to the middle.
Plugging in these values of p and q into the expression for expected winnings gave you a result of 500/13, or approximately $38.46. Indeed, that was more than the $20 had you always gone for the middle door and Monty had caught onto your scheme.
For extra credit, you played a similar game with Monty, but this time you had to pay $80 up front before selecting your first door. If the prize money remained $100, this particular game wasn't worth playing. How much should the prize money have been to make this new game worthwhile?
Working through a similar analysis, such a game only became worthwhile when the prize exceeded $144.
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!
Email Zach Wissner-Gross at [email protected].
+41,900 $38.46 $144