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.
The end of daylight saving time here on the East Coast of the U.S. got me thinking more generally about the calendar year. Each solar year consists of approximately 365.24217 mean solar days. That’s pretty close to 365.25, which is why it makes sense to have an extra day every four years. However, the Gregorian calendar is a little more precise: There are 97 leap years every 400 years, averaging out to 365.2425 days per year.
Can you make a better approximation than the Gregorian calendar? Find numbers L and N (where N is less than 400) such that if every cycle of N years includes L leap years, the average number of days per year is as close as possible to 365.24217.
It’s peak fall foliage season in Riddler Nation, where the trees change color in a rather particular way. Each tree independently begins changing color at a random time between the autumnal equinox and the winter solstice. Then, at a random later time for each tree — between when that tree’s leaves began changing color and the winter solstice — the leaves of that tree will all fall off at once.
At a certain time of year, the fraction of trees with changing leaves will peak. What is this maximal fraction?
Solution to last week’s Riddler Express
Congratulations to 👏 David Cohen 👏 of Silver Spring, Maryland, winner of last week’s Riddler Express.
Last week, the winner of a particular baseball game was determined by the next pitch. The pitcher either threw a fastball or an offspeed pitch, while the batter was similarly anticipating a fastball or an offspeed pitch. If the batter correctly guessed the pitch would be a fastball, they had a 1-in-5 chance of hitting a home run. If the batter correctly guessed the pitch would be offspeed, they had a 1-in-2 chance of hitting a home run. But if the batter guessed incorrectly, they struck out and lost the game. (The batter was guaranteed to swing either way.)
To spice things up, the pitcher truthfully announced the probability with which they’d throw a fastball. Then the batter truthfully announced the probability with which they’d anticipate a fastball.
Assuming both pitcher and batter were excellent logicians, what was the probability that the batter hit a home run?
A good place to start was the mindset of the pitcher. You didn’t yet know what probability the batter would announce, but let’s call it b. Meanwhile, suppose you were considering announcing a fastball probability of p. What were the batter’s chances of hitting a home run, in terms of p and b?
The batter would correctly anticipate a fastball with probability pb, so the probability of hitting a home run off a fastball was pb/5. The batter would correctly anticipate an offspeed pitch with probability (1−p)(1−b), so the probability of hitting a home run off an offspeed pitch was (1−p)(1−b)/2. Adding these probabilities together gave you the total probability of a home run, which was 7/10pb − p/2 − b/2 + 1/2, which we’ll call P.
At this point, the Problem Solving & Posing class at The Hewitt School decided to examine the partial derivative of P with respect to b, which was 7/10p − 1/2. This was equal to zero when p was 5/7. When p was less than 5/7 (meaning the partial derivative was negative), the batter could improve their chances of hitting a home run by lowering the value of b. For example, if the batter announced b was 0, then P was 1/2 − p/2, which was always greater than 1/7. And when p was greater than 5/7 (meaning the partial derivative was positive), the batter could improve their home run odds by similarly increasing the value of b, again resulting in P being always greater than 1/7.
But when p was exactly 5/7, the batter was effectively pinned. The value of P was 1/7 and didn’t change no matter what probability the batter announced. And so the probability of a home run was 1/7. For MLB, that would be a rather high probability.
Solution to last week’s Riddler Classic
Congratulations to 👏 Christian Wolters 👏 of San Jose, California, winner of last week’s Riddler Classic.
Last week, you purchased 150 pieces of candy to distribute for Halloween. However, you weren’t sure how many trick-or-treaters would visit you. Based on previous years, it could have been anywhere from 50 to 150 (inclusive), with each number being equally likely.
As the trick-or-treaters arrived, you could have decided to give each of them one, two or three candies. You wanted to avoid running out of candy, but you also wanted to avoid having any candy left over. Let X represent the number of trick-or-treaters who didn’t get candy (if you did run out) or the number of leftover pieces (if you didn’t run out).
The day before Halloween, you came up with a strategy to minimize the expected value of X. What was this minimum expected value?
The “MassMutual Crew” of Springfield, Massachusetts, came up with a strategy that resulted in a fairly low value of X. First, they gave out 100 candies to the first 50 trick-or-treaters. (Whether it was exactly two candies per kid or alternated between one and three candies made no difference.) From there, they gave out one candy per kid for however many kids showed up. For this strategy, the expected value of X was precisely the expected value of the difference between the number of trick-or-treaters and 100, which turned out to be 50·51/101, or about 25.2475.
Solver Rohan Lewis proved this was indeed the minimum expected value of X by recognizing that X could be zero for at most one value, and then increased by at least 1 for each trick-or-treater more or less than that value. By symmetrically placing that “zero case” in the middle between 50 and 150 (i.e., when there were 100 trick-or-treaters) and making sure everyone beyond the 50th trick-or-treater got at most one candy, Rohan arrived at the same strategy as the MassMutual Crew.
Finally, solver Starvind extended the puzzle, analyzing cases where your regret for each leftover candy was not necessarily the same as your regret for each empty-handed trick-or-treater. Starvid found that If you regretted each empty-handed trick-or-treater k times more than each leftover candy, then instead of planning for 100 trick-or-treaters you should plan for (99+301k)/(2+2k) trick-or-treaters.
I for one had way too much leftover candy. So much regret.
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.