Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

E.g. I'm using this formulas for calculating day of week (Julian calendar):

\begin{align} a & = \left\lfloor\frac{14 - \text{month}}{12}\right\rfloor\\ y & = \text{year} + 4800 - a \\ m & = \text{month} + 12a - 3 \end{align} \begin{align} J\!D\!N = (\text{day} + \left\lfloor\frac{153m+2}{5}\right\rfloor + 365y+ \left\lfloor\frac{y}{4}\right\rfloor - \left\lfloor\frac{y}{100}\right\rfloor + \left\lfloor\frac{y}{400}\right\rfloor - 32045)\text{mod}\text{7} \end{align}

And I know that in Julian calendar, leap year is a year which:

\begin{align} \text{year}\:mod\:4=0 \end{align}

Using simple python program, I can solve this problem very fast. And answer (if we starting for leap year) is 28 year cycle.
But how to correctly prove this hypothesis, using only math equations? Is it possible?

share|improve this question
With the Gregorian calendar there's a cycle of exactly 400 years. –  egreg Oct 23 '13 at 11:06

5 Answers 5

Nice equation, but incorrect. The day for any date advances one day per year, two days in leap years. For non-leap years, if we start in 2003 then the repeats are in 2014, 2020,2025 and 2031. The pattern is 11, 6, 5, 6 (starting in 2003). Leap years repeat every 28 years. The last leap year was 2012, the next repeat of the days and dates will be 2040.

I'm a mechanical engineer, not a mathematician.

share|improve this answer

I can directly say 28 years. It's because 7 is a prime number, thus is relatively prime with every natural number smaller than itself. How does this information helps us solve the problem. This way:

You know that $365 \equiv 1 (mod\, 7)$ and $366 \equiv 2 (mod\, 7)$. As 1 year in each $4$ year contains $366$ days. Then, in every $4$ years, we have a $5$ day iteration in days. So when does the loop goes back to the beginning? We have to find the Leas Common Multiple of $5$ and $7$, to find the number of the days iterated. $lcd[5,7]=35$. That is, when the loop was over, we were back to the beginning. In how many years, $35$ days iteration happens? $35*4/5=28$ years.

Edit: I've noticed that I did not mention how to use the info at the beginning. As 7 is relatively prime with every number smaller than itself, the answer would always* be the multiplication of 7 with loop lenght of years for different day content (Sorry for my English, that was a complicated way to explain. $4$ for this situation, as in every 4 years we have $1$ plus day. That is, in any 2 years that have 4k years difference, they have the same number of days).

Anyway, in any case we're gonna look for we're gonna look at the lenght of the year loop (let's say $l$ years) and days of iteration (let's say $i$ days). Then find the $lcm[7,i]$ then multiplicate it with $l/i$. As $7$ is prime, if $i<7, lcm[7,i]=7*i$. Then what we're looking for is actually $7*i*l/i = 7*l$

*Except $6$ years of loop. If it was $6$, then we would be looking for $lcm[7,7]$ which is $7$.

share|improve this answer

If you note that $365 \equiv 1 \pmod 7$, you know that the day advances by one each non-leap year. It advances by two each leap year. Since the leap years come in a four year cycle. You need to find a cycle that is a multiple of four years that shifts the day by a multiple of seven days. You can then observe that in $28$ years, you have $7$ leap years and shift the day by $35$ days, which is a multiple of $7$. You therefore get a repeat after $28$ years.

share|improve this answer
@egreg: In the Julian calendar 2100 is a leap year. That was the change to Gregorian. Why should 2090 be the same as 2018? That is a span of 72 years which is not a multiple of 28. –  Ross Millikan Jan 22 at 17:11

2003 and 2020 are NOT identical, 2020 is a leap year whereas 2003 is not, 2003 repeats in 2014,2025,2031 and 2042.

share|improve this answer

Leap years are not every four years.

They are every four years unless the year is divisible by 100; except if it is divisible by 400 ehen it is a leap year.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.