The repetition of the weekdays every $28$ years is based on the assumption that every fourth year is a leap year. This assumption is, however, broken for years such as $2100$ (which is not a leap year). More precisely, since the date we switched to Gregorian calendar, and until the date we switch to something else:
- Every year divisible by $4$ is a leap year,
- Except for the years divisible by $100$, which are not,
- Except for the years divisible by $400$, which are leap years again.
This means that the pattern will break again around years $2200$ and $2300$, but not around $2400$, and will break again around year $2500, 2600, 2700$ (but not $2800$) etc.
It also means that the pattern will repeat every $400$ years. Namely in $400$ years you have $100-3=97$ leap years and $303$ "ordinary" years, and so the number of days is:
$$303\times 365+97\times 366\equiv 303\times 1+97\times 2=497\equiv 0\pmod 7$$
(as $365\equiv 1\pmod 7$), so the number of days in $400$ consecutive years happens to be divisible by $7$.
NEW ANSWER!
Let's choose our base starting point is Day 1 = Jan 1, 2000 (which was a leap year) and Day 0 = Dec 31, 1999. Day 0 was a Fri $=5$. So let $M_{2000} = 5$.
If we were asked what day of the week was the $k$th day of $2000$ that'd be easy. As the days repeat ever seven days we'd have $D = k + M_{2000}\pmod 7$.
And if we were asked what day of the week was Month $d$, 2000, we could calculate that $k = d + $ sum of the number of days in the months before Month $\pmod 7$.
So Jan $d$, 2000: $D = d + M_{2000}\pmod 7$.
Feb $d$, 2000: $D= d+ 31 +M_{2000}\equiv d+3 +M_{2000}\pmod 7$
March $d$, 2000: $D = d + 31 + 29 + M_{2000} \equiv d+ 4 + M_{2000}\pmod 7$
... and so on.
In general. Month $d$, 2000: $D= d+ c_m + M_{2000}\pmod 7$ where $c_m = $ sum of then number of in the months before Month $\pmod 7$.
Okay, so what about Month $d$, $20xx$?
In general a year has $365=52*7 + 1 \equiv 1 \pmod 7$ so if $D$ is the day of the week for Month $d$ $xxxx$ then the day of the week of Month $d$ $xxxx+1$ will be $365 + D \equiv 1+ D\pmod 7$.
So if we completely ignored leap years we'd have:
Month, d, 20$xx$ would be $D= d + c_m + xx + M_{2000}\pmod 7$.
But we can't ignore leap years. We must add a day for every leap year encountered.
Okay.... bear with me.....
$2000$ was a leap year but we took that into account with the $c_m$s. So for $2000$ we don't make any adjustments. But to compare the dates of $2001$ to the dates of $2000$ the fact that $2000$ had $366 \equiv 2\pmod 7$ days means we must adjust and add $1$. They next time we adjust will be when we go from $2004$ to $2005$ and $2004$ also has $366$, not $365$ days.
so the formula is Month $d$, 20$xx$ would be $D = d + c_m +xx +\lceil \frac {xx}4\rceil + M_{2000}\pmod 7$.
But note, the $c_m$ codes were calculated for the year 2000 that was a leap year in which February has $29$ days. To adjust for years in which Feb has $28$ days we must increase $c_1$ and $c_2$ by $1$. (This is a little counter intuitive... but the days of 2001 after February have been adjusted by $01 + \lceil \frac {01}4\rceil = 2$ already but it is the days before February 29 that need adjusting because there is no Feb 29 in 2001 so all the days need to be pushed forward to fill the gap).
So we are $90\%$ of the way there.
Month $d$, 20$xx$ would be $D = d + c_m +xx +\lceil \frac {xx}4\rceil + M_{2000}\pmod 7$.
But what of other centuries?
Well, our formula $D = d + c_m +xx +\lceil \frac {xx}4\rceil + M_{mm00}\pmod 7$ would still work but for different values of $M_{mm00}$.
Now one ordinary century year has 100 years out of which 76 years are ordinary year and 24 years are leap year so odd days are 124($76 \times 1 +24\times 2)$.
So $124\equiv 5\pmod 7$ days.
One leap century year has 75 ordinary years and 25 leap year so odd days are 125($75\times 1+25\times 2$) and $125\equiv 6\pmod 7$ days.
so as $M_{2000}=5$ we'd have $M_{2100} \equiv 5+5\equiv 3$, $M_{2200}\equiv 3+5\equiv 1\pmod 7$. And $M_{2300}\equiv 1+5\equiv 6\pmod 7$ but, $M_{2400}\equiv 6+6\equiv 5$. And we repeat.... (Very nice, the Gregorian calendar based make every four hundred years has a multiple of $7$ days so we always repeat.
So if $M_{xx00} = c_y = 5, 3,1,6$ for leap, leap +100, leap + 200, leap + 300$
We get the formula.
Month $d$, $yyxx$ where $yyxx = 400*k + 100*y + xx$ then $D = d + c_m + c_y + xx+\lceil \frac {xx}4\rceil\pmod 7$
==========
Dec 31, 1299 was on a thursday$= 4$.
So Jan k, 1300 would be $k$ days later. So that would be $k +4$. But there are only seven days a week so they repeat every $7$ days so we will use $k+ 4\pmod 7$ to figure out the day of the week.
So for any date we will estimate the numbers of days since Dec 31, 1299 and take the remainder divided by $7$. To get that Jan k, 1300 is on the date $k +4\pmod 7$ we have an offset of $4$. If we let Jan account for offset of $1$ and $1300$ account for offset of $3$ the formula works so far for the Dates Jan 1-31, 1300. $D = d + c_m +c_y \pmod 7$ where $d=1-31$ and $c_m =1$ (completely arbitrary) and $c_y=3$ (ditto).
Now Feb m, 1300 would be $31 + m + $ days later. But $31\equiv 3 \pmod 7$ so instead off offsetting by $4$ we offset but $4+ 3 \equiv 0\pmod 7$. So if the offset code, $c_m$ of Jan was $1$, and Jan has $31 \equiv 3 \pmod 7$ days, then the offset code, $c_m$ for February must be $1+3\equiv 4\pmod 7$.
And so on for all the months. Feb has $28\equiv 0 \pmod 7$ days so the $c_m$ for March is $4+0=0$. And March has $31\equiv 3 \pmod 7$ days so the offset for april is $4 + 3 \equiv 0 \pmod 7$. And so on.
So in this way we can figure out all the days from Jan 1, 1300 to Dec 31 1300.
Okay, now a year has $365=52*7 + 1\equiv 1 \pmod 7$. So any day of a date in 1301 will be $1$ day latter than the same date in $1300$. And any day of a date in 130$j$ will be $j$ days latter than the same date in $1300$.
But every fourth year is a leap year and that addes an extra day every four years.
So that tells us how to calculate any date in the $1300$. Now a century has some many days $\pmod 7$. So that is way we have the century code, $c_y$. Some centuries have leap years on $xx$00 and others don't so the code takes that into account.
And that's that.
....
Although.... I don't think those values are right. The ceiling rather than floor can only work if $xx00$ belongs to the century before (which properly it does) And I did calculations and the century offsets didn't agree with my calculations. (But it was late and I didn't do it too carefully, and maybe I was assuming all centuries began with 00 and maybe they do work for centuries begining on 01.)
Best Answer
Yes, you are right (temporarily).
As you noted, leap years have a different shape from others. So if you start with a leap year calendar, the next leap year calendar will come 4 years later.
The calendar for each leap year is $4+1=5$ days “ahead” of the previous one, so each step from one leap year to the next takes you 5 steps forward. Since 5 and 7 are relatively prime, you have to take seven 5-step jumps before you get back to the original calendar. And seven jumps of 4 years make 28 years, so you are right.
Enjoy your triumph while you can, because 2100 is not a leap year and all your calculations will fail. One major software package (was it Lotus 1-2-3?) thought that 1900 was a leap year, which it isn’t, and consequently had as its “zero” of date numbers a day one day earlier than any sensible person would have put it. All later spreadsheet programs have to be compatible with that, so the strange “zero” (30 December 1899 instead of 31 December) will be built into every program from now until the human race becomes extinct.