Formulae for Leap Years
Many know it by heart. The leap years are the seven years 3, 6, 8, 11, 14, 17, 19 of the cycle of 19 years. There is a formula for these years. The seven leap years, out of 19 years, satisfy
(year*7 + 1)%19 < 7.
where x%19 is the remainder after division by 19. The value of x%19 can thus be 0,1,...,18. There is an alternative formula for the leap years. The seven leap years, out of 19 years, also satisfy
(year*12 + 17)%19 >= 12,
preferring positive numbers. The formulae can be naturally adapted to include the generational parameter n:
(year*7 + 1 - n)%19 < 7.
or
(year*12 + 17 + n)%19 >=12.
For n=4 we have, preferring positive numbers, (year*7 + 16)%19 < 7, or (year*12 + 2)%19 >=12. Anyway, they are the seven years 1, 4, 6, 9, 12, 14, 17 of the cycle of 19 years that should be leap years at this time.
(year*7 + 1)%19 < 7.
where x%19 is the remainder after division by 19. The value of x%19 can thus be 0,1,...,18. There is an alternative formula for the leap years. The seven leap years, out of 19 years, also satisfy
(year*12 + 17)%19 >= 12,
preferring positive numbers. The formulae can be naturally adapted to include the generational parameter n:
(year*7 + 1 - n)%19 < 7.
or
(year*12 + 17 + n)%19 >=12.
For n=4 we have, preferring positive numbers, (year*7 + 16)%19 < 7, or (year*12 + 2)%19 >=12. Anyway, they are the seven years 1, 4, 6, 9, 12, 14, 17 of the cycle of 19 years that should be leap years at this time.