The previous post explained why the Gregorian calendar is the way it is, and that it consists of a whole number of weeks. It follows that the Gregorian calendar repeats itself every 400 years. For example, the calendar for 2025 will be exactly the same as the calendar for 1625 and 2425.
There are only 14 possible printed calendars, if you don’t print the year on the calendar. There are seven possibilities for the day of the week for New Years Day, and there are two possibilities for whether the year is a leap year.
A perpetual calendar is a set of the 14 possible calendars, along with some index that tells which possible calendar is appropriate in a given year.
Are each of the 14 calendars equally frequent? No, because only in 97 out of 400 years should the calendar include a leap day.
Are each of the non-leap year calendars equally frequent? No, because there are 303 non-leap years, and 303 is not divisible by 7. What about the leap year calendars? Again no, because 97 is not divisible by 7 either.
Now we might expect that within ordinary years, or within leap years, each potential calendar is used about the same number of times. But is that true? Here’s some Python code to answer that question.
ordinary_counts = [0]*7 leap_counts = [0]*7 y = 0 # year mod 400 leap_counts[0] = 1 d = 0 # days since January 1 at beginning of cycle def leap(y): return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0) for y in range(1, 400): d += y*365 # whether previous year was a leap year if leap(y - 1): d += 1 if leap(y): leap_counts[d % 7] += 1 else: ordinary_counts[d % 7] += 1 print(ordinary_counts) print(leap_counts)
Here’s the output:
[45, 43, 44, 40, 45, 34, 52] [10, 11, 17, 16, 23, 13, 7]
The calendar types are not so evenly distributed in frequency. Within leaps years, the most common calendar type is more than three times as common as the least common type.
Here are bar charts of the frequencies. The charts start with Saturday because January 1, 2000 was a Saturday.
First, ordinary years:
Then, leap years: