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.
Suppose I asked you to generate the biggest number you could using exactly three nines. Specifically, you can add, subtract, multiply, divide, exponentiate or write them side-by-side. Given this challenge, 9×9×9 is a pretty good start — it equals 729. Better yet is just writing the nines side-by-side, giving you 999. The biggest number is 999, which equals 9387420489. If you were to write one digit of that number every second, it would take you more than a decade to write the whole thing.
Now let’s up the challenge: What’s the biggest number you can generate using exactly four threes?
This week’s Riddler Classic comes to us from Oren, who asked not to be further identified:
Now that Halloween has come and gone, your chances of getting free candy have similarly disappeared. Desperate for sugar, you wander into the candy store, where three kinds of candy are being sold: Almond Soys (yummy, sounds vegan!), Butterflingers and Candy Kernels.
You’d like to buy at least one candy and at most 100, but you don’t care precisely how many you get of each or how many you get overall. So you might buy one of each, or you might buy 30 Almond Soys, six Butterflingers and 64 Candy Kernels. As long as you have somewhere between one and 100 candies, you’ll leave the store happy.
But as a member of Riddler Nation, you can’t help but wonder: How many distinct ways are there for you to make your candy purchase?
Solution to last week’s Riddler Express
Congratulations to 👏 Julian, Peter and Rose Champkin, 👏 winners of last week’s Riddler Express.
Last week, six snails were situated at the corners of a regular hexagon whose sides were all 10 meters. Each snail was determined to reach its clockwise neighbor, and they all traveled at the same speed. But as each snail moved along, slowly but surely, the snail it was traveling toward was also moving toward another snail. The result was six snails — and six trails of slime — that spiraled inward toward the center of the hexagon. How long was each snail’s slimy trail?
As the Champkins noted, rather than looking at all six snails at once, it’s simpler to consider two snails A and B, one of whom (A) is pursuing the other (B). Suppose they start 10 meters apart, and they each travel at a speed of 1 meter/second. If B were moving directly away from A, then A would never catch B; instead, they’d always stay 10 meters apart. If B were moving directly toward A, they’d each travel 5 meters before reaching each other. But what about cases when B is traveling in other directions?
As solver Sameer Gauria observed, it’s all about how much of B’s velocity is in the same direction as A’s velocity. As shown in the animation below, the angle between A’s and B’s trajectories is always 60 degrees (that is, 360 degrees divided by the number of sides, six). That means B is moving away from A at half the speed with which A is pursuing B, since the cosine of 60 degrees equals 0.5.
So how does that get us to an answer? Well, if snail B weren’t moving, then A would travel 10 meters to reach it. But since B is moving away from A at half of A’s speed, A will have to travel twice as far — 20 meters — to catch B.
This math worked out rather nicely for six snails. Solver Beau Baker took this a step further, finding the general formula for how long the trails are for N snails, arranged in an N-gon with side length 10: 10/(1-cos(2𝜋/N)).
Just for fun, here’s what that looks like for 20 snails:
Solution to last week’s Riddler Classic
Congratulations to 👏Chris Reedy 👏 of Bellingham, Washington, winner of last week’s Riddler Classic.
Last week, the sultan asked her vizier to present her with 10 candidates for marriage. The vizier searched the kingdom for the 10 most desirable partners but didn’t know whom the sultan would prefer. If she saw them all at the same time, she would easily rank them from 1 (the best partner) to 10 (the worst partner). But the vizier could only present the candidates one at a time and in a random order. Upon seeing each candidate, the sultan had to reject or accept him. If a candidate was rejected, the sultan could not pick him again. But on seeing each new candidate, she knew exactly where he’d stack up relative to the candidates she had rejected. If she strategized, what was the highest rank she could expect her chosen candidate to have, on average?
Chris solved the problem by working backwards from the end, starting with scenarios in which the sultan made it to the 10th and final candidate (presumably because she wanted to make sure she wasn’t settling with any of the others). At this point, she marries this candidate no matter what. His rank could be any value from 1 to 10 with equal probability, so his average rank will be 5.5.
Next, Chris went back in time to when the sultan was considering the ninth candidate. If she determines that his average will be better than 5.5 (i.e., your typical 10th candidate), she’ll do the math and marry him. If not, then she’ll reject him and take her chances with the 10th candidate.
Solver Scott Wu came up with a general formula for the average overall rank of the Nth candidate being considered when he’s the kth best among those seen so far: 11k/(N+1). (The 11 in the numerator comes from that fact that 11 is one more than 10, the total number of candidates that will be seen.) With Scott’s formula in hand, let’s return to the sultan’s consideration of that ninth candidate. If he’s the best one she’s seen so far (better than the eight she already rejected), his average overall rank will be 1.1. That’s impressive — she should marry him! If he’s the second best she’s seen so far, meaning only one of the eight rejects was better, his average overall rank will be 2.2, and so she should still pick him. It turns out as long as he’s one of the four best among the first nine she sees, she should marry him. Otherwise, she might as well pass on the ninth candidate and marry the 10th. Averaging all these cases together (when the ninth candidate is the best of those she’s seen, second best, third best, etc.), she can expect to achieve a rank of approximately 4.28 by the time she sees the ninth candidate.
Phew! We’re getting there. Continuing with this analysis, Chris found that when the sultan faced her eighth candidate, she could achieve an average rank of about 3.59. Working all the way back to the beginning, when the sultan is considering the very first candidate, the average overall rank of her ultimate spouse winds up being roughly 2.558, our final answer. All things considered, that’s pretty amazing — she’ll usually wind up with a top-tier candidate!
How does the math shake out if we change the number of candidates? Sure enough, the average selected candidate becomes less desirable, which makes sense — it’s harder to pick a needle out of a haystack as the haystack gets bigger and bigger. But surprisingly, the sultan still does really well for herself. The chart below shows how she’ll do when there are anywhere from one to 20 candidates.
But even with 100 candidates, she can achieve an average of about 3.6; with 1,000 candidates, that number jumps to a whopping … 3.83. Needless to say, this sultan must be an excellent judge of character.
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 firstname.lastname@example.org.