Skip to main content
Menu
Can You Get A Haircut Already?

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

From Blue Taylor comes a puzzle of stacking cards that he has seen making the rounds on the internet (to avoid spoilers, I’ll reference original sources of the puzzle in next week’s column):

You’re in a dark room and seated at a table with a deck of 52 cards on it, stacked into a single pile. You also happen to know that currently, within that stack of cards, exactly 13 of them are face up, while all the others are face down.

While you can’t see the cards, you can feel them and move them around. But you can’t tell by touch which cards are face up and which are face down.

How can you make two piles of cards that are guaranteed to have the same number of face-up cards? (And yes, each of these two piles must have at least one card.)

Submit your answer

Riddler Classic

From Dave Moran comes a question we’ve all faced at some point when waiting in line for a haircut:

At your local barbershop, there are always four barbers working simultaneously. Each haircut takes exactly 15 minutes, and there’s almost always one or more customers waiting their turn on a first-come, first-served basis.

Being a regular, you prefer to get your hair cut by the owner, Tiffany. If one of the other three chairs opens up, and it’s your turn, you’ll say, “No thanks, I’m waiting for Tiffany.” The person behind you in line will then be offered the open chair, and you’ll remain at the front of the line until Tiffany is available.

Unfortunately, you’re not alone in requesting Tiffany — a quarter of the other customers will hold out for Tiffany, while no one will hold out for any of the other barbers.

One Friday morning, you arrive at the barber shop to see that all four barbers are cutting hair, and there is one customer waiting. You have no idea how far along any of the barbers is in their haircuts, and you don’t know whether or not the customer in line will hold out for Tiffany.

What is the expected wait time for getting a haircut from Tiffany?

Submit your answer

Solution to last week’s Riddler Express

Congratulations to 👏 Marc Lachance 👏 of Munich, Germany, winner of last week’s Riddler Express.

Last week, it was a warm, sunny day. But when you toggled between the Fahrenheit and Celsius scales on your thermometer, you noticed something interesting: The digits of the temperature — when rounded to the nearest degree — had switched. For example, this would have worked for a temperature of 61 degrees Fahrenheit, which corresponds to a temperature of 16 degrees Celsius.

However, the temperature on that day was not 61 degrees Fahrenheit. What was the temperature?

Given the “warm, sunny day” description in the puzzle, it was safe to assume that the Fahrenheit temperature was a two-digit whole number (more on that later). One way to attack this puzzle was to then suppose the Fahrenheit temperature was AB — that is, it had the digit A in the tens place and the digit B in the ones place. Mathematically, that meant the value of the temperature was 10A+B.

As you may recall from science class, a Fahrenheit temperature F corresponds to a Celsius temperature C = 5/9(F−32). (If it’s been a while since you’ve seen this formula, you can check it with water’s freezing point, 0 C and 32 F, as well as its boiling point, 100 C and 212 F.) Plugging our Fahrenheit temperature, 10A+B, into this formula gave a Celsius temperature of 50/9A+5/9B−160/9.

In order for this new expression to be the same as the original temperature, but with its digits reversed, it needed to have a B in the tens place and an A in the ones place, meaning it had to equal 10B+A. In other words, you had to find solutions to the equation 50/9A+5/9B−160/9 = 10B+A. After some rearranging, this equation became A = (85B+160)/41.

At this point, you had to plug the digits from 0 to 9 in for B, and round the corresponding values of A in the above equation.

  • When B was 0, A rounded to 4. That means 40 F is equivalent to 04 C. However, there were two problems with this solution: It’s unclear whether the digits actually “flipped” here (04°C should really be written without the leading zero, as 4 C), and 40 F would not be the temperature of a “warm sunny day.”
  • When B was 1, A rounded to 6. That means 61 F is equivalent to 16 C. But this was the temperature given in the original problem.
  • When B was 2, A rounded to 8. That means 82 F is equivalent to 28 C. This looks like a winner…
  • For values of B greater than 2, the corresponding value of A exceeded 10, meaning it could not have been a single digit.

That meant the temperature had to be 82 degrees Fahrenheit, or 28 degrees Celsius.

While this algebraic approach was all well and good, many solvers turned to their computers. That included a first-time solver in 8-year-old Aaron Vaughn, who found the answer using a Python script.

Welcome to Riddler Nation, Aaron!

Some solvers had even more fun with this puzzle, extending it beyond two digits. They searched for three-, four- and even five-digit temperatures such that the digits were reversed when written in Fahrenheit and Celsius. Solver Jan Hattendorf identified the next few temperatures that worked after 82 F:

  • 4,862 F, which equals 2,684 C
  • 5,082 F, which equals 2,805 C
  • 96,635 F, which equals 53,669 C

Angela Zhou found an even higher temperature — an absurdly hot 9,663,413,658,635 F, which equals 5,368,563,143,669 C.

While the problem was slightly ambiguous, it was fair to assume that the “warm, sunny day” was in fact on the Earth’s surface, and so temperatures like 96,635 F were not the expected answer. But if any members of Riddler Nation solve these puzzles in or around the sun’s corona, I’d love to hear about it.

Solution to last week’s Riddler Classic

Congratulations to 👏 Tom Bassine 👏 of Farmington, Connecticut, winner of last week’s Riddler Classic.

Last week, you played a game with two fair coins, labeled A and B. When you flipped coin A, you got 1 point if it came up heads, but you lost 1 point if it came up tails. Coin B was worth twice as much — when you flipped coin B, you got 2 points if it comes up heads, but you lost 2 points if it came up tails.

To play the game, you made a total of 100 flips. For each flip, you chose either coin, and you knew the outcomes of all the previous flips. In order to win, you had to finish with a positive total score. (Finishing with 2 points was just as good as finishing with 200 points, and finishing with 0 or −2 points was just as bad as finishing with −200 points.)

If you optimized your strategy, what percentage of games would you win?

First, a shoutout to Angela Zhou, who noticed the similarity between this puzzle and a 2017 Riddler Classic from Guy Moore about miniature football. For long-standing members of Riddler Nation, this Classic was like greeting an old friend.

One way to solve this puzzle was with dynamic programming — that is, recursively breaking the problem up into smaller problems, solving those and putting them back together. For example, if you were on your 100th and final coin flip, should you flip A or B? If your points were well into positive or negative territory, it didn’t make a difference.

But what if your score was close to zero? If you had −1 points, then your only chance of finishing with a positive score and winning was to flip coin B (worth 2 points). If you had 0 or 1 points, it again didn’t make a difference which coin you picked, as your chances of winning were 50 percent. And if you had 2 points, you could guarantee a win if you played it safe, flipping coin A (worth 1 point).

From there, you could work your way back to your 99th, penultimate flip, knowing full well what your chances of winning would be after the flip (e.g., if you had 2 points after your 99th flip, you’d still be guaranteed a victory). And then back further to your 98th coin flip, and so on. Eventually, you had a map of your chances of winning as a function of your current score, and how many flips you had left, much like the one generated by solver Jason Ash:

Probability of winning from each game state

When you worked your way back to your very first coin flip, you found that your chances of winning this game stood at about 64 percent.

At first, it might have seemed counterintuitive that your chances of winning could be anything other than 50 percent. After all, each coin flip had an equal chance of increasing or decreasing your score by the same amount. On average, you’d expect to finish the game with zero points. So then how could you possibly expect to win more games than you lost?

The answer had to do with the optimal strategy. While dynamic programming gave the correct answer, you needed further analysis to see what was really going on. It turned out that you should only have flipped coin A when your score was positive. It’s analogous to basketball strategy in the fourth quarter of a close game: When you’re ahead, you want to milk the clock, but when you’re behind, you want to speed up the pace of play.2

When your score was positive, you’d flip coin A, so that your score wouldn’t move around as quickly, and you’d make it to the end of your 100 flips with your lead intact. But if your score was negative, you wanted to score as many points as you could to give yourself a chance of winning at all. In other words, you’d flip coin B.

In the end, you were more likely to have a small, positive score, and less likely to have a larger, negative score. Your average final score still worked out to be zero, but your chances of winning did indeed exceed 50 percent.

After finding the answer, many solvers extended the problem in new and fascinating directions. Josh Silverman wondered what would happen if, instead of 100 coin flips, the game called for 1,000 flips, or 1,000,000 flips. As the number of coin flips approached infinity, what happened to your chances of winning the game? Shockingly, the answer turned out to be 2/3. To see an explanation for this, check out Josh’s writeup.

Solver Laurent Lessard also took on the problem’s extra credit, which asked what would happen to your chances of winning when coin A wasn’t fair. When coin A always came up tails (with probability 1), then your best bet was to stick with coin B until coin A guaranteed victory. And when coin A always came up heads, then you could guarantee a victory by only flipping coin A. In between, the math got hairier, resulting the the following nonlinear function:

Probability of winning as a function of the fairness of coin A

When coin A was fair, you can see your chances of winning were close to 2/3. But if coin A strayed slightly from fairness in either direction, your chances of winning would rapidly rise or fall.

Laurent even looked at when both coins were unfair:

Probability of winning as a function of the fairness of both coin A and coin B

Anyway, if this sort of riddle ever makes a third appearance in this column, it will likely require an Elam Ending to make the endgame strategy more interesting.

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.

CORRECTION (Feb. 28, 1:02 p.m.): An earlier version of the Riddler Classic solution said that after coin A comes up tails, you want to stick with coin B for the entire game. But the correct solution sticks with coin B for most of the game, only until coin A guarantees a victory.

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!

  2. Fortunately, there was no intentional fouling in last week’s puzzle.

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

Comments