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-sized 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 if you have a favorite puzzle collecting dust in your attic, find me on Twitter.
From FiveThirtyEight contributor Milo Beckman, a sartorial stumper:
Three smart logicians are standing in a line, so that they can only see the logicians in front of them. A hat salesman comes along and shows the three logicians that he has three white hats and two black hats. He places one hat on each logician’s head and hides the remaining hats.
He then says to the logicians, “Can anyone tell me what color hat is on her own head?” No one responds.
He repeats, “Can anyone tell me what color hat is on her own head?” Still no answer.
A third time: “Can anyone tell me what color hat is on her own head?” One of the logicians speaks up and gives the correct answer.
Who spoke, and what color hat is on her head?
From Dan Waterbury, a painting puzzle:
You play a game with four balls: One ball is red, one is blue, one is green and one is yellow. They are placed in a box. You draw a ball out of the box at random and note its color. Without replacing the first ball, you draw a second ball and then paint it to match the color of the first. Replace both balls, and repeat the process. The game ends when all four balls have become the same color. What is the expected number of turns to finish the game?
Extra credit: What if there are more balls and more colors?
Solution to last week’s Riddler Express
Congratulations to ÑÑâÐ Tom Mahon ÑÑâÐ of Kingsland, Texas, winner of last week’s Express puzzle!
In each of the last three years — 2014, 2015 and 2016 — a global temperature record has been set. Assuming that accurate temperature records exist since 1880, what is the probability of this having happened at random?
If we have accurate records from 1880 to 2016, that means we’re dealing with 137 years of potential records. Now we need to figure out how many ways there are of choosing these three specific years — 2014, 2015 and 2016 — in order from those 137. There are 137 ways to choose the first, 136 ways to choose the second and 135 ways to choose the third. Therefore, the probability that these temperature records occurred in these three at random is 1/(137*136*135) = 1/2,515,320 or about 0.00004 percent.
Solution to last week’s Riddler Classic
Congratulations to ÑÑâÐ Layne Webb ÑÑâÐ of Shepherdsville, Kentucky, winner of last week’s Classic puzzle!
From a shuffled deck of 100 cards that are numbered 1 to 100, you are dealt 10 cards face down. You turn the cards over one by one. After each card, you must decide whether to end the game. If you end the game on the highest card you were dealt, you win; otherwise, you lose. What is the strategy that optimizes your chances of winning?
In general, of course, you should end the game when you turn over a high card, and continue drawing if you turn over a low card. This will give you the best chances at stopping on the highest card in the hand. Also, in general, you should be pickier — only stopping for very high values — with your numbers earlier in the game and laxer late in the game, as you near the final card. As you’re further through the deck, there are fewer cards remaining that could trump the one you’ve chosen. But just how high is a high card, and just how low is a low card? And when is too early, and when is too late?
Some decisions in the game are easy. If the card you just flipped over is not the highest card you’ve seen so far, you should continue flipping — you’re guaranteed to lose otherwise. If the card you’ve just flipped over is the highest card you’ve seen so far, you’ve got a decision to make. Roughly speaking, you should stop if there is a greater than ½ chance that the number you’re looking at will end up being the highest you see.
To arrive at precise cutoffs, most solvers took a computational approach. And many, such as Guy Moore, Daniel Eriksson and Marc Goessling, were kind enough to share their code. When you flip the first card out of the 10, those three solvers found, you should stop if it’s at least 93. There are a bunch of cards left that could top yours if you choose something lower. But, if you get to the ninth card and only one card remains unseen, you should relax your restrictions, and stop if it’s at least 55. Laurent Lessard plotted this optimal strategy:
As the game gets “bigger” — decks and hands with more cards — the shape of the solution looks quite similar, as Laurent again plotted, in this case for a deck of 1,000 cards and a hand of 40 cards:
Want to submit a riddle?
Email me at firstname.lastname@example.org.