Magical Patterns

May 13, 2016

(Published in Aftenposten Friday May 13, 2016, in Norwegian.)

When I heard that Friday the thirteenth was more likely than any other day of the week, I thought it was nonsense. Why on earth should it be so? I decided to check myself by writing a computer program.

Here are all the days from 2000 to 2016 marked with its own square. Each line is one year, Fridays are red, and Saturdays and Sundays are blue. Every time there is the thirteenth in a month, I've added a little dot. The black frames mark Friday the thirteenth.

Can you find May 13th 2016?

The question is therefore: If we look at all the dots marking the thirteenth, what is the distribution between the different days of the week?

It turns out that the statement is correct, but only just so. Friday the thirteenth occurs on average more often than, say, Monday the thirteenth. In four hundred years, the thirteenth is a Friday 688 times, but just a bit less for the other days of the week:

It turns out that the distribution of weekdays repeats itself after exactly four hundred years. The entire picture, from 2000 to 2399, looks as follows. January 1, 2000, was a Saturday (it is the blue dot in the top left), and January 1, 2400, is also a Saturday. Because the distribution of weekdays repeats itself after four hundred years, the picture that begins with year 2400 would be exactly the same.

(To see all the years, see this image.)

The reason why the calendar repeats itself after four hundred years, is the system we use for leap years. The year 2000 was a leap year, with one extra day in February, and the general rule is that a year is a leap year if it is divisible by four.

The exception is once every hundred years, because then it is *not* a leap year, except every four hundred years, because then it *is* a leap year again, just like in 2000 and 2400, etc. We can see the exceptions for each century quite clearly in the figure above. (I've added green horizontal lines to make it even clearer.)

In four hundred years we get exactly 146,097 days. (That is because 365 times 400 is 146,000, and because there are 97 leap days during four hundred years.) The great thing with this number is that it is divisible by seven, and that is the same as 20,871 weeks.

This means that it is rather arbitrary that it is a Friday that occurs most often. Had we shifted all the days by one, it would have been Saturday that was the most common. But this is not so. Friday the thirteenth is more common than any other weekday.

by Roger Antonsen