# RIDDLER EXPRESS PUZZLE 11-04-2022

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.

FiveThirtyEight

✨ SOLUTION ✨

85 / 351 ≈  .2421652
85 leap years every 351 years

A good initial guess may be to try repeating decimals like .242424... = 8 / 33

This is already closer to the actual value than the Gregorian calendar's .2425  =  97 / 400

But can we do better ?

Let's find out by using continued fractions...

To get the continued fraction of a real number R, we simply subtract the integer part of R and then take the reciprocal of the remainder.  This process continues until we reach the desired level of precision, or stops when the remainder is 0 (if R is rational).

Here's the process for R = .24217

1 / 24217 = 4.12933

Subtract 4 and take the reciprocal of .12933

1 / .12933 = 7.73212

Subtract 7 and take the reciprocal of .73212

1 / .73212 = 1.3659

Subtract 1 and take the reciprocal of .3659

1 / .3659 =  2.733

Subtract 2 and take the reciprocal of .733

1 / .733 = 1.36423

Subtract 1 and take the reciprocal of .36423

1 / .36423 = 2.7455

Subtract 2... Now at this point we can continue the process, or just take what we have so far as an estimate of our original number .24217

In the terminology of continued fractions, our estimate is written by taking the integer components (known as coefficients) at each step of the process:

[0 ; 4, 7, 1, 2, 1, 2]

To recover an estimate our original number, we take the reciprocal of the rightmost coefficient and add it to the next coefficient (on its left). Then continue the process by taking the reciprocal of the result and adding it to the next coefficient, and so on:

1/2 + 1 = 3/2

2/3 + 2 = 8/3

3/8 + 1 = 11/8

8/11 + 7 = 85/11

11/85 + 4 = 351 / 85

85 / 351 ≈ .2421652

This is a pretty good approximation with denominator close to but still less than 400.

In fact, a more precise continued fraction

[0 ; 4, 7, 1, 2, 1, 2, 1]

Would have yielded 116 / 479 ≈ .24217119

Which is a better approximation, but with denominator > 400