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.
I’m cracking a safe with a two-digit passcode. (It’s not a very secure safe.) Both digits are between 0 and 9, and when I type in each digit, that digit is shown via a standard seven-segment display.2 Only the most recent digit I enter shows up on the single-digit display.
By pressing two different digits at the same time, the safe will give me the benefit of the doubt and open if either ordering of the digits is the correct passcode. For example, if I press the 1 and the 2 at the same time, the safe will open if the passcode is either “12” or “21.”
Finally, I note that the display isn’t functioning perfectly. Any segment that is part of a number in the passcode appears to be slightly faded. This fade is visible even when the segment isn’t lit. And any segment that is part of both digits (if there are any such segments) is twice as faded.
Unfortunately, after some mental math, I realize that I still don’t have enough information to open the safe with confidence.
What are all the possible two-digit passcodes for the safe?
From Dean Ballard comes a matter of asymmetrical pizza:
Dean made a pizza to share with his three friends. Among the four of them, they each wanted a different amount of pizza. In particular, the ratio of their appetites was 1:2:3:4. Therefore, Dean wants to make two complete, straight cuts (i.e., chords) across the pizza, resulting in four pieces whose areas have a 1:2:3:4 ratio.
Where should Dean make the two slices?
Extra credit: Suppose Dean splits the pizza with more friends. If six people are sharing the pizza and Dean cuts along three chords that intersect at a single point, how close to a 1:2:3:4:5:6 ratio among the areas can he achieve? What if there are eight people sharing the pizza?
Solution to last week’s Riddler Express
Congratulations to 👏 Silvio 👏 of Ravenna, Italy, winner of last week’s Riddler Express.
Last week, the Riddler Shirt Store was selling N kinds of shirts, each kind with a picture of a different famous mathematician. Unfortunately, on average, 80 percent of orders were returned.
That was because the company’s website had customers order their shirts using a code (from 1 to N), but it did not state which code corresponded to which shirt. Each customer knew which mathematician — and therefore which shirt — they wanted.
But to get that desired shirt, they had to enter a random shirt code and order the corresponding shirt without knowing which mathematician they’d get. If that shirt depicted the wrong mathematician, they randomly selected a different (untested) code, and repeated this process until the desired shirt arrived.
How many different shirts did the store sell?
The first time you placed an order, the probability it was the correct shirt was 1/N. That meant there was a 1/N chance of not needing any returns. But there was a (N−1)/N chance it was the wrong shirt, in which case you had a 1/(N−1) of guessing correctly among the remaining shirts. That meant there was a (N−1)/N · 1/(N−1), or a 1/N, chance of needing exactly one return. In other words, the probability of needing no returns was equal to the probability of needing exactly one return.
Another way to see this was to list out the order in which you intended to test the different codes. Solver Mary E. Morley noted that the correct code was equally likely to be anywhere in this list, which meant any number of returns, from zero to N−1, was equally likely.
So, what was the average number of returns for each shirt that was correctly ordered? That was 0/N + 1/N + 2/N + 3/N + … + (N−1)/N, which simplified to (N−1)·N/(2N), or (N−1)/2. In the problem, this ratio was 80 percent to 20 percent, meaning there were 4 (i.e., 80 divided by 20) returns for every shirt that was correctly ordered. Setting (N−1)/2 equal to 4 and solving revealed that N was 9.
In general, if the Riddler Shirt Store sold N shirts, the expected return rate was (N−1)/2 (the number of returns per correctly ordered shirt) divided by (N−1)/2 + 1. This simplified to (N−1)/(N+1), a surprisingly (at least to me) concise expression.
Solution to last week’s Riddler Classic
Congratulations to 👏 Ruben te Wierik 👏 of Utrecht, the Netherlands, winner of last week’s Riddler Classic.
Graydon, the submitter of last week’s puzzle, was about to depart on a boating expedition seeking footage of the rare aquatic creature, F. Riddlerius. Every day he was away, he sent a handwritten letter to his best friend, David. But if Graydon still had not spotted the creature after N days (where N was some very, very large number), he returned home.
Knowing the value of N, Graydon confided to David there was only a 50 percent chance of the expedition ending in success before the N days had passed. But as soon as any footage was collected, he would immediately return home (after sending a letter that day, of course).
On average, for what fraction of the N days should David have expected to receive a letter?
This puzzle was admittedly ambiguous, but I found that the most interesting mathematics occurred when you assumed that Graydon’s probability of spotting the creature — which we can call p — was the same each day, and that each day was independent of the next. That meant the probability of not finding the creature on a given day was (1−p). Since Graydon only had a 50 percent chance of finding the creature after N days, you knew that (1−p)N = 1/2.
Taking the natural logarithm of both sides of the previous equation, solver Shankar Sivarajan found N·ln(1−p) = −ln(2). Why would Shankar do such a thing? Because at this point you can use the information that N is “very, very large” to your advantage. When N is very large, p is very small, which means that ln(1−p) is approximately equal to −p. Therefore, Np was approximately ln(2).
That was useful information to have, but you still had to calculate the expected number of letters. At this point, let’s define q = 1−p, the probability Graydon didn’t see the creature on a given day. The probability Graydon sent exactly one letter was 1−q. The probability he sent exactly two letters was q(1−q), or q−q2. The probability he sent exactly three letters was q2(1−q), or q2−q3. This pattern continued, so that the average number of letters (when Graydon spotted the creature) was 1−q + 2(q−q2) + 3(q2−q3) + 4(q3−q4) + … + N(qN−1−qN). After accounting for the telescoping in this sum, it became 1 + q + q2 + q3 + q4 + … + qN−1 − NqN.
The last term in that sum, −NqN, could be rewritten as −N(1−p)N, or −N/2. This precisely canceled out the expected number of letters Graydon wrote when he never spotted the creature. That left you with a finite geometric series, which could be written as a single quotient: (1−qN)/(1−q), which was equivalent to (1−(1−p)N)/p. And since we already knew that (1−p)N = 1/2, this became 1/(2p).
Finally, the puzzle asked “for what fraction of the N days” David could expect to receive a letter. That meant you had to divide the expected number of letters, 1/(2p), by the number of days, N, giving you 1/(2Np). And here was where you could apply the fact that Np approached ln(2) in the limit of large N. In the end, David could expect to receive letters on 1/(2ln(2)) of the days, or on about 72.135 percent of the days.
Throughout this analysis, we kept asking when Graydon would spot the F. Riddlerius. But we never stopped to ask how the F. Riddlerius might feel about all this. (It was very pleased to have remained hidden half the time.)
Want more puzzles?
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.