Site icon R-bloggers

optimal leap year

[This article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A riddle about leap years: a solar year consists of approximately 365.24217 mean solar days, which is why there is a leap year approximately every four years. Approximately because the Gregorian calendar plans 97 and not 100 leap years over 400 years. Is this the optimal solution? No, since the Gregorian difference is 3.3 10⁻⁴ day per year, or 0.132 day per 400 years, while using 85 leap years over every 351 years leads to a difference of 4.76 10⁻⁶ day per year, or 0.002 day per 400 years… (With a further gain by a factor 4 with 116 leap years every 479 years.) This can be found by a basic R code

for(N in 10:1000)
for(L in 1:N){
  p=abs(L/N-.24217)
  if(p<T){T=p;lo=L;no=N}}
To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.