A year is a leap year if it is divisible by 4, but not if it is divisible by 100, unless it is also divisible by 400. This means the average length of a calendar year is
365 + 1/4 - 1/100 + 1/400 = 365.2425 days
which approximately matches the length of an actual year (the number of days it takes the earth to go around the sun once).
Given p, the length of a year on another planet in units of days on that planet, and given that normal years have N days and leap years have N+1 days, where N=floor(p), find integer vector m>0 defining leap years [years divisible by m(1) are leap years, but years divisible by m(2) are not, unless they are divisible by m(3), but then not if they are divisible by m(4), etc.] so that
p = N + 1/m(1) - 1/m(2) + 1/m(3) - 1/m(4) + ...
Include enough terms so that this is correct to four decimal places. Note that m(i+1) should be an integer multiple of m(i). Results are not necessarily unique. For example, if p=365.2425 then m=[4 100 400] is an exact answer, but m=[4 132 13068] also could be used (and [4 132] gives 365.2424, a better approximation than [4 100], which gives 365.2400).
The test cases were calculated from actual data (length of day and tropical orbit period) at www.heavens-above.com, but they are not necessarily as well-defined or accurately known as the number of decimal places used here might imply.
4805 Solvers
Remove any row in which a NaN appears
5950 Solvers
Equidistant numbers containing certain value in an interval
70 Solvers
308 Solvers
Is this triangle right-angled?
1905 Solvers