My teacher taught an expression to find the day of any date in the Gregorian calendar.
Expression:
$$ \bbox[5px,border:2px solid red] { D\equiv {d+c_m+c_y+c+\left\lfloor\dfrac c4\right\rfloor \pmod7} } $$
Where $D$ is the day code of the given date and day can be found from the following table,$d$ is the date,$c$ is the last two digits of the year(ones and tens place digit),$c_m,c_y$ are given below.
And
Day code($D$): \begin{array}{|c|c|} \hline \mathrm{\color{red}{Day}}& \color{red}{\text{Day Code}}\\ \hline \mathrm{Sunday}&0\\ \hline \mathrm{Monday}&1\\ \hline \mathrm{Tuesday} &2\\ \hline \mathrm{Wednesday} &3\\ \hline \mathrm{Thursday} &4\\ \hline \mathrm{Friday}&5\\ \hline \mathrm{Saturday} &6\\ \hline \end{array}
Month code($c_m$):
For ordinary year: \begin{array}{|c|c|} \hline \color{red}{\text{January}}& \color{red}{\text{February}}&\color{red}{\text{March}}\\ \hline 1&4&4\\ \hline \color{red}{\text{April}}& \color{red}{\text{May}}&\color{red}{\text{June}}\\ \hline 0 &2&5\\ \hline \color{red}{\text{July}}& \color{red}{\text{August}}&\color{red}{\text{September}}\\ \hline 0 &3&6\\ \hline \color{red}{\text{October}}& \color{red}{\text{November}}&\color{red}{\text{December}}\\ \hline 1&4&6\\ \hline \end{array}
For leap year: \begin{array}{|c|c|} \hline \color{red}{\text{January}}& \color{red}{\text{February}}&\color{red}{\text{March}}\\ \hline 0&3&4\\ \hline \color{red}{\text{April}}& \color{red}{\text{May}}&\color{red}{\text{June}}\\ \hline 0 &2&5\\ \hline \color{red}{\text{July}}& \color{red}{\text{August}}&\color{red}{\text{September}}\\ \hline 0 &3&6\\ \hline \color{red}{\text{October}}& \color{red}{\text{November}}&\color{red}{\text{December}}\\ \hline 1&4&6\\ \hline \end{array}
Century code($c_y$): \begin{array}{|c|c|} \hline \color{red}{\text{Century Leap Year}}& \color{red}{\text{Century Code}}\\ \hline 1300&3\\ \hline 1400&1\\ \hline 1500&6\\ \hline 1600 &5\\ \hline 1700 &3\\ \hline 1800&1\\ \hline 1900 &6\\ \hline 2000&5\\ \hline \end{array}
More generalised Century code: \begin{array}{|c|c|} \hline {\color{red}{\text{Leap Year Century}}}& \color{red}{\text{Century Code}}\\ \hline \text{Leap Year Century}&5\\ \hline \text{Leap Year Century+100}&3\\ \hline \text{Leap Year Century+200}&1\\ \hline \text{Leap Year Century+300} &6\\ \hline \end{array}
He refused to give the derivation of the above expression(saying it won't be asked in the exam) but I can't use this expression without the derivation or without knowing how it works.
What I tried(think):
The denominator is $7$ because the numerator gives the total odd days(I think) and we have to find net odd days.
By observing, one can easily find that century code is two less than the number of odd days in a century.
For example: Number of odd days in $100$ years are $5$ and century for (leap year century $+ 100$ years) is $3$(that is $5-2$).
Number of odd days in $200$ years are $3$ and the century code for (leap year century$+200$ years) is $1$(that is $3-2$).
Number of odd days in 300 years are $1$ and the century code for (leap year century$+300$ years) is $6$(that is $1-2=-1$ and $7-1=6$ ).
The number of odd days in 400 years are $0$ and the century code for (leap year century) is ($0-2=-2$ and $7-2=5$)
I am unable to find any relation between odd days in the month and month code.
What is my question? How is this expression derived?
I am not able to derive the expression.
Thanks
Note:
By leap year century, I meant century year ($1200,1300,1400$) which is a leap year(example $400,800,1200,1600$).