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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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|cite|improve this question
With the Gregorian calendar there's a cycle of exactly 400 years. – egreg Oct 23 '13 at 11:06

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|cite|improve this answer
2020 is not the same as 2025 because 2020 is a leap year. The period is 28 or a circular permutation of 6, 11, 11. – lhf Jul 28 '15 at 12:09

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|cite|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|cite|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 '15 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|cite|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|cite|improve this answer
Please, note that I mean a Julian calendar (as described in a question), not Gregorian. – Artem Agasiev Feb 2 '15 at 15:04

protected by Zev Chonoles Jul 28 '15 at 10:55

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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