# Can You Knock Down The Gates?

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.

## Riddler Express

From the fantastical land of Central Earth comes a physics riddle that will break down your doors:

In an effort to break open the gates of the city Tinas Mirith, an army of orcs first tried using a battering ram, but to no avail. They next erected a 100-foot pole with a very massive weight at the top (i.e., the weight is much, much heavier than the rest of the pole). The pole is also anchored at the bottom, so that as the weight falls the entire pole rotates around its bottom without slipping.

How far away should the orcs position the vertical pole from the gates so that when the weight comes crashing down on the gates, its horizontal speed is as great as possible?

## Riddler Classic

I have made a square peanut butter and jelly sandwich, and now it’s time to slice it. But rather than making a standard horizontal or diagonal cut, I instead pick two random points along the perimeter of the sandwich and make a straight cut from one point to the other. (These points can be on the same side.)

My slice is “reasonable” if I cut the square into two pieces and the smaller resulting piece has an area that is at least one-quarter of the whole area. What is the probability that my slice is reasonable?

## Solution to last week’s Riddler Express

Congratulations to ÑÐ±âÑÐ±Ã·âÐ±âÐ±â¤ÐÐ±â Ben Gundry ÑÐ±âÑÐ±Ã·âÐ±âÐ±â¤ÐÐ±â of San Jose, California, winner of last week’s Riddler Express.

Last week, you were challenged to improve upon the Gregorian calendar. Now, 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.

But could you make a better approximation than the Gregorian calendar? More specifically, you were asked to find numbers *L* and *N* (where *N* was less than 400) such that if every cycle of *N* years included *L* leap years, the average number of days per year was as close as possible to 365.24217.

Many solvers used a “brute force” approach, checking all the values of *N* from 1 to 399. For each value of *N*, you had to find the whole number *L* that resulted in *L*/*N* being as close as possible to 0.24217. Solver Tiago Batalhao knew this meant *L* was either floor(0.24217·*N*) or ceiling(0.24217·*N*) — the whole numbers on either side of 0.24217*N*. In fact, you could find the best *L* for a given *N* by rounding 0.24217·*N* to the nearest whole number. Finally, the best pair of *N* and *L* minimized the absolute difference between *L*/*N* and 0.24217, which could be written as a function of *N*: abs(round(0.24217·*N*)/*N *− 0.24217).

But brute force wasn’t the only way to solve this puzzle. A particularly elegant approach I’d like to highlight involved mediants and Farey sequences. Without getting into the details, we could start with the fractions 0/1 and 1/1. The mediant of these two fractions was calculated by adding across the numerators and denominators and denominators, which was 1/2. Since 0.24217 was between 0/1 and 1/2, we next calculated the mediant of *these* two fractions: 1/3. It was also between 0/1 and 1/3, and so the next mediant of interest was 1/4. And after that, it was 1/5 — the first mediant that was *less* than 0.24217. From there, you wanted the mediant of 1/5 and 1/4, which was 2/9.

Continuing in this fashion, the last mediant that was less than 0.24217 was 7/29, after which came 8/33. *Their* mediant was 15/62, after which came 23/95, 31/128 and 54/223. These last two fractions were on either side of 0.24217, and their mediant was 85/351, or approximately 0.242165. This turned out to be the best approximation where the denominator was less than 400, meaning *N* was 351 and *L* was 85.

In the end, having 85 leap years every 351 years was about 70 times *more accurate* (in terms of averaging out to the right number of solar days per solar year) than the Gregorian calendar’s 97 leap years out of 400. That means we might have to skip a scheduled leap day … in a few thousand years or so.

## Solution to last week’s Riddler Classic

Congratulations to ÑÐ±âÑÐ±Ã·âÐ±âÐ±â¤ÐÐ±â Adam Richardson ÑÐ±âÑÐ±Ã·âÐ±âÐ±â¤ÐÐ±â of Old Hickory, Tennessee, winner of last week’s Riddler Classic.

Last week, it was peak fall foliage season in Riddler Nation, where the trees changed color in a rather particular way. Each tree independently began 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 had begun changing color and the winter solstice — the leaves of that tree would all fall off at once.

At a certain time of year, the fraction of trees with changing leaves was expected to peak. What was this maximal fraction?

Solver Tom Keith simulated thousands of trees — quite beautifully, I might add — finding that the peak appeared to occur 63 percent of the way through the fall. And at this peak, almost 37 percent of the trees had changing leaves.

Meanwhile, many solvers like Andrea Andenna were able to calculate the exact answer. To do this, you wanted to first determine the probability *p*(*t*) of any given tree having changing leaves as a function of time *t*, which you could conveniently rescale between 0 (representing the autumnal equinox) and 1 (representing the winter solstice). Then, you could use calculus to maximize *p*(*t*).

So what was this probability distribution? A tree had changing leaves at time *t* if the leaves started changing *before* *t* and — assuming that was true — the leaves fell *after t*. The probability of the former was simply *t*. Now, assuming the leaves started changing at a time *x* prior to *t*, what was the probability that the leaves fell at a time *y* after *t*? It was equal to the ratio of the amount of time after *t* to the amount of time after *x*, or (1−*t*)/(1−*x*). Meanwhile, *x* was equally likely to be anywhere between 0 and *t*, which meant you had to integrate this ratio over this range and then normalize by dividing by *t*. In the end, this integral came out to (*t*−1)/*t*·ln(1−*t*). Multiplying this by *t* — again, that was the probability that the leaves started changing before *t* — gave you *p*(*t*) = (*t*−1)·ln(1−*t*).

To maximize this function, you took its derivative, which was ln(1−*t*)+1, and set it equal to zero. That meant the peak occurred a fraction 1−1/*e*, or about 63.21 percent, of the way through the fall. That places the peak around Nov. 18, so there’s still time to see them if you happen to live in Riddler Nation!

However, the puzzle asked for the maximum fraction of trees with changing leaves, not *when* this maximum occurred. You could find that fraction by evaluating *p*(1−1/*e*), which was an even nicer-looking expression: **1/**** e**, or about 36.79 percent.

## 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 riddlercolumn@gmail.com.