Reliable Formula for repetition of of calendar I am trying to get a formula for repetition of calendars (for years to repeat with same day-date pattern)
I could see the following rule in some of the online sites

a) If given year is at 1st position after Leap year then next repeated
calendar year is Given Year + 6.
b) If given year is at 2nd position after Leap year then next
repeated calendar year is Given Year + 11.
c) If given year is at 3rd position after Leap year then next
repeated calendar year is Given Year + 11.
d) leap years repeat after 28 years

But i did some testing and could see there are exceptions for all these cases. I went through patterns and could not see any reliable pattern which always work. I believe the issue is because fourth centuries are leap years and other centuries are not.
Is there any reliable formula any one is aware to find repetition of calendars ?
 A: Given a non-leap century year $xx00$ in the Gregorian calendar, the following exceptions apply:

*

*Year $xx00-28$ (ending with $72$) repeats $40$ years later in $xx12$.

*Year $xx00-24$ (ending with $76$) repeats $40$ years later in $xx16$.

*Year $xx00-20$ (ending with $80$) repeats $40$ years later in $xx20$.

*Year $xx00-16$ (ending with $84$) repeats $40$ years later in $xx24$.

*Year $xx00-12$ (ending with $88$) repeats $40$ years later in $xx28$.

*Year $xx00-10$ (ending with $90$) repeats $12$ years later in $xx02$.

*Year $xx00-9$ (ending with $91$) repeats $12$ years later in $xx03$.

*Year $xx00-8$ (ending with $92$) repeats $12$ years later in $xx04$.

*Year $xx00-6$ (ending with $94$) repeats $6$ years later in $xx00$.

*Year $xx00-5$ (ending with $95$) repeats $6$ years later in $xx01$.

*Year $xx00-4$ (ending with $96$) repeats $12$ years later in $xx08$.

*Year $xx00-3$ (ending with $97$) repeats $12$ years later in $xx09$.

*Year $xx00-2$ (ending with $98$) repeats $12$ years later in $xx10$.

*Year $xx00-1$ (ending with $99$) repeats $6$ years later in $xx05$.

*Year $xx00$ repeats $6$  years later in $xx06$.

A: If the remainder when year is divided by $400$ is between $00-99$
Let $a$ be the last two digits of the year.
If the remainder when $a$ divided by $28$ is $b$ then the calendar is same as that of $2000+b$
If the remainder when year is divided by $400$ is between $100-199$
Let $a$ be the last two digits of the year.
If $a=00$ (not the remainder when divided by $28$) then the calendar is same as that of $2021$.
If the remainder when $a$ ($a\ne 00$) divided by $28$ is $b$ then the calendar is same as that of $2004+b$
If the remainder when year is divided by $400$ is between $200-299$
Let $a$ be the last two digits of the year.
If $a=00$ (not the remainder when divided by $28$) then the calendar is same as that of $2003$
If the remainder when $a$ ($a\ne 00$) divided by $28$ is $b$ then the calendar is same as that of $2008+b$
If the remainder when year is divided by $400$ is between $300-399$
Let $a$ be the last two digits of the year.
If $a=00$ (not the remainder when divided by $28$) then the calendar is same as that of $2007$
If the remainder when $a$ ($a\ne 00$) divided by $28$ is $b$ then the calendar is same as that of $2012+b$
We divided into $4$ cases because every $28$ years the calendar repeats except at centuries not divisible by $400$. Also note that the calendar repeats every $400$ years.
