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.
The 24 Game is a fun test of mathematical fluency. In the Riddler version of the game, your goal is to make a numerical expression that equals 24, using each of four given numbers once, along with parentheses, addition, subtraction, multiplication, division and exponentiation.
For example, if I gave you the numbers 1, 2, 3 and 8, then valid solutions would be 8×3×(2−1) and (3+1)×(8−2), since they both equal 24. However, concatenation is not an allowed operation, which means (32−8)×1 is not a solution — that is, you can’t smush the 3 and the 2 together to get 32.
Given the four numbers 2, 3, 3 and 4, how can you make 24?
Extra credit: Can you find another way to make 24?
The solution to this Riddler Express can be found in the following week’s column.
From Austin Shapiro comes a story of stacking that may stump you:
Mira has a toy with five rings of different diameters and a tapered column. Each ring has a “correct” position on the column, from the largest ring that fits snugly at the bottom to the smallest ring that fits snugly at the top.
Each ring she places will slide down to its correct position, if possible. Otherwise, it will rest on what was previously the topmost ring.
For example, if Mira stacks the smallest ring first, then she cannot stack any more rings on top. But if she stacks the second-smallest ring first, then she can stack any one of the remaining four rings above it, after which she cannot stack any more rings.
Here are a four different stacks Mira could make:
This got Mira thinking. How many unique stacks can she create using at least one ring?
Extra credit: Instead of five rings, suppose the toy has N rings. Now how many unique stacks can Mira create?
The solution to this Riddler Classic can be found in the following week’s column.
Solution to last week’s Riddler Express
Congratulations to 👏 Bram Carlson 👏 of Fort Lauderdale, Florida, winner of last week’s Riddler Express.
Last week, my swimming pool was opening soon, with its five swimming lanes (and no general swim area). It seemed likely that social distancing regulations would prevent swimmers from occupying adjacent lanes.
I wanted to know what would happen if a queue of swimmers arrived at the pool when it opened at 9 a.m. One at a time, each person randomly picked a lane among the lanes that were available (i.e., the lane had no swimmer already and was not adjacent to any lanes with swimmers), until no more lanes were available.
At this point, what was the expected number of swimmers in the pool?
This was a simplified version of a previous Riddler, which looked at the general case of N lanes — last week’s extra credit — but in the context of misanthropes and houses.
First off, it was helpful to label the lanes — say, 1, 2, 3, 4 and 5, in that order. Whenever the first swimmer chose lane 2, the second swimmer had to choose either lane 4 or 5. At this point, there would be no more available lanes, meaning there were exactly two swimmers in total. This same reasoning applied to lane 4 as well.
But if the first swimmer happened to choose lane 3, the second and third swimmers would choose lanes 1 and 5, meaning there would be exactly three swimmers in total.
A trickier case was when the first swimmer chose lane 1. The second swimmer could then choose from lanes 3, 4 and 5, each with a one-third probability. If the second swimmer chose lane 3 or lane 5, then there would be three swimmers in total (lanes 1, 3 and 5). But if the second swimmer chose lane 4, then once again there would be no more available lanes, meaning there would be two swimmers in total. And when the first swimmer chose lane 5, the math worked out the same, with the second swimmer choosing from lanes 1, 2 and 3. So when the first swimmer chose lane 1 or 5, there was a two-thirds chance of having three swimmers and a one-third chance of having two swimmers — an average of 8/3 swimmers.
Overall, that meant there was a 40 percent chance of two swimmers (when the first swimmer chose lane 2 or 4), a 20 percent chance of three swimmers (when the first swimmer chose lane 3) and a 40 percent chance of 8/3 swimmers (when the first swimmer chose lane 1 or 5). Putting these probabilities together, the average number of swimmers was 37/15, or about 2.467.
And what if there are more than five lanes? In the best-case scenario, about half of the lines would be occupied — when swimmers are in alternating lanes. And in the worst-case scenario, about a third of lanes would be occupied — when swimmers have two empty lanes on either side of them. As previously explored on this column, the exact answer is (1−e−2)/2, or about 0.432, which falls neatly between the extremes.
To see where this limiting behavior comes from, check out the explanations from Josh Silverman and Enrique Treviño.
And if you ever happen to be first in line at my local pool, be a good sport and choose lane 3.
Solution to last week’s Riddler Classic
Congratulations to 👏 Josh Rosenbluth 👏 of Oxnard, California, winner of last week’s Riddler Classic.
Last week, you were arranging the stars on the American flag. The 50 stars on the current flag form two rectangles: The larger rectangle is 5 stars wide, 6 stars long; the smaller rectangle is embedded inside the larger and is 4 stars wide, 5 stars long. This square-like pattern of stars is possible because the number of states (50) is twice a square number (25).
Now that the House of Representatives has passed legislation that would make the District of Columbia the 51st U.S. state, a natural question was how to aesthetically arrange 51 stars on the flag.
One pleasing design had a star in the middle, surrounded by concentric pentagons of increasing side length. The innermost pentagon had five stars, and subsequent pentagons were made up of 10, 15 and 20 stars. All told, that’s 51 stars.
It just so happened that when N equaled 50, N was twice a square and N+1 was a centered pentagonal number. After 50, what was the next integer N with this property?
First off, any number that was twice a square could be written as 2x2, where x is an integer. But what about centered pentagonal numbers? For example, the seventh centered pentagonal number is 1 + 5 + 10 + 15 + 20 + 25 + 30. Other than the 1, every other term in the sum is a multiple of 5. Factoring out that 5 gives us 1 + 5 ᐧ (1 + 2 + 3 + 4 + 5 + 6). Now that expression inside the parentheses is something we can work with — it’s the sixth triangular number! For many solvers, this connection between centered pentagonal and triangular numbers unlocked a formula: Centered pentagonal numbers can be written as 1 + 5y(y+1)/2, where y is an integer.
Now all you had to do was find integers x and y such that 2x2 was one less than 1 + 5y(y+1)/2, meaning 2x2 = 5y(y+1)/2, or 4x2 = 5y(y+1). Right around this point, most solvers started cranking through values on their spreadsheets or writing some code to do this for them. But there were a few brave souls who tried to solve this analytically.
Solver Grant Larsen noticed that the left side of that last equation was the square of 2x — an integer — which meant 5y(y+1) was also a square. Since 5 is prime and y and y+1 are guaranteed to be relatively prime, there were two possible cases: either (1) y and 5(y+1) were both square numbers, or (2) y+1 and 5y were both square numbers.
The first value of y to satisfy one of these cases — the former, as it turned out — was 4, since 4 and 5(4+1) are both squares. But this corresponded to N = 50, the value given in the problem. Trying out different squares, Grant found that the next solution — which happened to satisfy the latter case — was when y was 80, since 5(80) and 80+1 are both squares. This corresponded to N = 16,200.
You read that right. The next time our flag can go from its current square-like arrangement to a centered pentagonal number is when the 16,201st state joins the Union.
Here’s what the flag would look like:
Now it’s true that the above solution had an element of “guess and check.” Some solvers, like Gareth McCaughan and Laurent Lessard (admittedly out of his comfort zone with this puzzle) ventured deeper into number theory and into the realm of Pell equations. These are well studied, and Gareth and Laurent used them to find a closed-form solution for all such values of N. Solver Emma Knight further extended the problem, looking for square-like numbers that were one greater than a centered pentagonal number.
Oh, and in case you were curious, the next value of N that worked was 5,216,450. And after that, it was 1,679,680,800.
Even the United Federation of Planets doesn’t have a flag with that many stars.
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.