Solution to:
Friday the Thirteenth
In a period of 400 years, the cycle of weekdays makes one complete cycle through the years
(it cannot be a shorter period because of the odd leap year rule;
it does not have to be a longer period because a period of 400 years has
400 × 365 = 146000 normal days plus 100  3 = 97 leap days,
which makes 146097 days in total, which is divisible by 7).
Therefore, we only have to look at the probability in a period of 400 years,
for example the years 2001 up to 2400.
For a normal year, the distribution of the 13th days over the days of the week is as follows, if January 13th falls on weekday x:
x x+1 x+2 x+3 x+4 x+5 x+6
2 1 1 3 1 2 2
For a leap year, the distribution of the 13th days over the days of the week is as follows, if January 13th falls on weekday x:
x x+1 x+2 x+3 x+4 x+5 x+6
3 1 1 2 2 1 2
For subsequent years, these distributions shift cyclic one place to the right for normal years and two places to the right for leap years.
For three normal years followed by one leap year, we can now calculate the distribution of the 13th days:
x x+1 x+2 x+3 x+4 x+5 x+6
2 1 1 3 1 2 2 (normal year, not shifted)
2 2 1 1 3 1 2 (normal year, shifted one place to the right)
2 2 2 1 1 3 1 (normal year, shifted two places to the right)
+ 2 1 2 3 1 1 2 (leap year, shifted three places to the right)

8 6 6 8 6 7 7 (3 normal years and 1 leap year, not shifted)
For four normal years, we find:
x x+1 x+2 x+3 x+4 x+5 x+6
2 1 1 3 1 2 2 (normal year, not shifted)
2 2 1 1 3 1 2 (normal year, shifted one place to the right)
2 2 2 1 1 3 1 (normal year, shifted two places to the right)
+ 1 2 2 2 1 1 3 (normal year, shifted three places to the right)

7 7 6 7 6 7 8 (4 normal years, not shifted)
In four years, the latter two distributions shift five places cyclic to the right.
So for a period of 16 years with 4 leap years, we find:
x x+1 x+2 x+3 x+4 x+5 x+6
8 6 6 8 6 7 7 (3 normal years and 1 leap year, not shifted)
6 8 6 7 7 8 6 (3 normal years and 1 leap year, shifted 5 places to the right)
6 7 7 8 6 6 8 (3 normal years and 1 leap year, shifted 10 places to the right)
+ 7 8 6 6 8 6 7 (3 normal years and 1 leap year, shifted 15 places to the right)

27 29 25 29 27 27 28 (16 years with 4 leap years, not shifted)
For a period of 100 years with 24 leap years (the years 20012100, 21012200, and 22012300),
we can now calculate the distribution of the 13th days:
x x+1 x+2 x+3 x+4 x+5 x+6
27 29 25 29 27 27 28 (16 years with 4 leap years, not shifted)
29 25 29 27 27 28 27 (16 years with 4 leap years, shifted 20 places to the right)
25 29 27 27 28 27 29 (16 years with 4 leap years, shifted 40 places to the right)
29 27 27 28 27 29 25 (16 years with 4 leap years, shifted 60 places to the right)
27 27 28 27 29 25 29 (16 years with 4 leap years, shifted 80 places to the right)
27 28 27 29 25 29 27 (16 years with 4 leap years, shifted 100 places to the right)
+ 8 7 7 6 7 6 7 (4 normal years, shifted 120 places to the right)

172 172 170 173 170 171 172 (100 years with 24 leap years, not shifted)
For a period of 100 years with 25 leap years (the years 23012400),
we can also calculate the distribution of the 13th days:
x x+1 x+2 x+3 x+4 x+5 x+6
27 29 25 29 27 27 28 (16 years with 4 leap years, not shifted)
29 25 29 27 27 28 27 (16 years with 4 leap years, shifted 20 places to the right)
25 29 27 27 28 27 29 (16 years with 4 leap years, shifted 40 places to the right)
29 27 27 28 27 29 25 (16 years with 4 leap years, shifted 60 places to the right)
27 27 28 27 29 25 29 (16 years with 4 leap years, shifted 80 places to the right)
27 28 27 29 25 29 27 (16 years with 4 leap years, shifted 100 places to the right)
+ 7 8 6 6 8 6 7 (3 normal years and 1 leap year, shifted 120 places to the right)

171 173 169 173 171 171 172 (100 years with 25 leap years, not shifted)
Now we can calculate the distribution of the 13th days for the period 2001 up to 2400:
x x+1 x+2 x+3 x+4 x+5 x+6
172 172 170 173 170 171 172 (100 years with 24 leap years, not shifted)
170 173 170 171 172 172 172 (100 years with 24 leap years, shifted 124 places to the right)
170 171 172 172 172 170 173 (100 years with 24 leap years, shifted 248 places to the right)
+ 172 171 173 169 173 171 171 (100 years with 25 leap years, shifted 372 places to the right)

684 687 685 685 687 684 688 (400 years, not shifted)
Since January 13, 2001 (x in the distribution) is a Saturday,
we get the following probability for the 13th days over the days of the week:
Saturday:  684/4800 
Sunday:  687/4800 
Monday:  685/4800 
Tuesday:  685/4800 
Wednesday:  687/4800 
Thursday:  684/4800 
Friday:  688/4800 
Conclusion: the probability that the 13th of a certain month in a certain year is a Friday is the highest.
back to the puzzle
