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, 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.

Quick announcement: Have you enjoyed the puzzles in this column? If so, I’m pleased to tell you that we’ve collected many of the best, along with some that have never been seen before, in a real live book! It’s called “The Riddler,” and it will be released in October — just in time for loads of great holidays. It’s a physical testament to the mathematical collaboration that you, Riddler Nation, have helped build here, which in my estimation is the best of its kind. So I hope you’ll check out the book, devour the puzzles anew, and keep adding to our nation by sharing the book with loved ones.

And now, to this week’s puzzles!

Riddler Express

From Steve Gaukrodger, a small fruity puzzle:

You loaded a drying shed containing 1,000 kilograms of apricots. They were 99 percent water. After a day in the shed, they are now 98 percent water. How much do the apricots weigh now?

Submit your answer

Riddler Classic

From Michael Wales, flip and flip and flip some more:

I flip a coin. If it’s heads, I’ve won the game. If it’s tails, then I have to flip again, now needing to get two heads in a row to win. If, on my second toss, I get another tails instead of a heads, then I now need three heads in a row to win. If, instead, I get a heads on my second toss (having flipped a tails on the first toss) then I still need to get a second heads to have two heads in a row and win, but if my next toss is a tails (having thus tossed tails-heads-tails), I now need to flip three heads in a row to win, and so on. The more tails you’ve tossed, the more heads in a row you’ll need to win this game.

I may flip a potentially infinite number of times, always needing to flip a series of N heads in a row to win, where N is T + 1 and T is the number of cumulative tails tossed. I win when I flip the required number of heads in a row.

What are my chances of winning this game? (A computer program could calculate the probability to any degree of precision, but is there a more elegant mathematical expression for the probability of winning?)

Submit your answer

Solution to last week’s Riddler Express

Congratulations to 👏 Stephen Cappella 👏 of Castle Rock, Colorado, winner of last week’s Riddler Express!

Last week brought us to Riddler Laboratories, where you wanted to spin some samples in a centrifuge. To run safely, the centrifuge needed to be perfectly balanced along every axis; otherwise, the torque would damage the internal rotor. If a centrifuge has N equally spaced buckets, some of which you’d like to fill with K samples, and all samples are of equal weight, for what values of K can all the samples be spun in the centrifuge safely?

It turns out that we need to know some things about prime numbers to work safely in Riddler Lab. Specifically, as our winner Stephen explained, we can balance K samples in N buckets if and only if both K and N – K are expressible as the sum of prime factors of N.

For example, we can safely run seven samples (K = 7) in a 12-bucket centrifuge (N = 12). In this case, N has the prime factors 2 and 3, and we can add 2 + 2 + 3 = 7 to get to K, and 2 + 3 = 5 to get to N – K. We cannot, however, safely run 10 samples (K = 10) in a 21-bucket centrifuge (N = 21). In this case, N has the prime factors 3 and 7, and there is no way to add copies of these to get to N – K, i.e., 11.

Why does this formulation based on prime factors work? Solver Gavin Stewart explained it by talking about how you place the samples in the centrifuge. If one arrangement works (say, four samples) and another arrangement works (say, three samples), then an arrangement that combines those two others (four and three, say) will also work.

Stewart went into the math of it all: “Use the 12 buckets as an example: If you have five samples, 5 = 2 + 3 and 12 – 5 = 4 + 3, so it can balance. This can be done by using an arrangement of two samples together with a arrangement of three samples. However, with 11 samples: 11 = 4 + 4 + 3, meets the condition, but 12 – 11 = 1 does not. For the given example of N = 21 and K = 10: 10 = 7 + 3, but 21 – 10 can never be written as a sum of factors of 21. This also means that for a prime N, the only way to ever balance the centrifuge is with N samples. This also shows why 12 is a good number of buckets, because every number of samples can be balanced except for 1 and 11. It’s worth noting that K = 1 and K = N – 1 will never balance; so 12 is essentially a perfect number of buckets.”

Indeed, my unscientific survey of Amazon revealed many centrifuges with spaces for 12 samples. This problem has also been the subject of some academic study, and you can find a further mathematical discussion of the solution in this 2010 paper.

Solver Thomas Woodruff, on the other hand, submitted an out-of-the-box solution: Any number of samples can work, he wrote. Simply “add a number of centrifuge tubes filled with water necessary to balance the centrifuge.”

Solution to last week’s Riddler Classic

Congratulations to 👏 Adam Ghozeil 👏 of Corvallis, Oregon, winner of last week’s Riddler Classic!

Last week, we introduced the perfect puzzle for doodling during a boring class or meeting. Start with an empty 5-by-5 grid of squares, and choose any square you want as your starting square. The rules for moving through the grid from there are strict: 1) You may move exactly three cells horizontally or vertically, or you may move exactly two cells diagonally; 2) you are not allowed to visit any cell you already visited; and 3) you are not allowed to step outside the grid. You win if you are able to visit all 25 cells. Is it possible to win? If so, how? If not, what are the largest and smallest numbers of squares you can legally visit?

Yes! It is possible to win. In fact, there are 12,400 ways to do so.

Here’s one way, as animated by solver Luke Benz:

And another, from Hernando Cortina, who reports that he was indeed in a meeting when he solved the doodle game:

Solver Toby Roberts explained his approach: “I used Excel to map out the 25*8^24 path permutations (25 starting squares and 8 cardinal directions for each of 24 moves), stopping whenever a path either a) left the grid or b) repeated a square previously visited. It turns out that there are 12,400 unique paths that lead to a win. The number of paths to a win varies depending on which square you start with. The center square has the fewest winning paths (352), the squares surrounding the center square have more paths (400 or 412), and the squares on the outside have the most winning paths (548 or 552).”

Geoff Sutton verified that 12,400 number, also finding that the worst you can possibly do is to visit just eight squares:

There are 12400 ways to visit all 25 squares. The smallest number of squares you can visit and have no moves left is 8, and there are 32 ways to do this. pic.twitter.com/72SkAoDLYg — Geoff (@SuttonGL) July 30, 2018

If you solved this game and want another game for your next boring event (and who doesn’t?): Can you still win if the grid is 6-by-6? (I’ll reveal the answer on Twitter.)

Want to submit a riddle?

Email me at oliver.roeder@fivethirtyeight.com.