Leap years algorithm.
Every year that is evenly divisible by 4 is a leap year, except for years that are evenly divisible by 100, but even these years are leap years if they are evenly divisible by 400. The three steps to check out, detailed below:
- 1) A year that is divisible by 4 (no remainder when divided by 4) is a leap year...
- 2) But if the year is also divisible by 100 (no remainder when divided by 100), it's not a leap year, unless...
- 3) ... Unless it's divisible by 400 (no remainder when divided by 400).
- * Note: the term 'evenly divisible' has the same meaning as the term 'divisible' (no remainder when divided by a number other than zero).
How often do the leap years occur in the calendar?
Nearly once every four years, more exactly, 97 leap years at every 400 years.
Nearly once every four years is a leap year, and these years must be multiples of 4. More precisely, as we can calculate above, leap years happen in a cycle of 97 years out of every 400.
Examples of leap years.
- Examples of leap years which are multiples of 4 but not of 100 nor of 400: 1584, 1588, 1596, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2004, 2008, 2012, 2016, 2020, 2024, 2028, etc.
- Examples of common years (NOT LEAP YEARS), which are multiples of 100, but not of 400: 1700, 1800, 1900, 2100, 2200, 2300 - these are not leap years.
- Example of leap years which are multiples of 400: 1600, 2000, 2400.