### Wednesday, October 12, 2005

## Friday XIII

Ever wonder whether there are years without any Friday XIII? How many there are in the *worst* years? If there are always the same number? Well, I did, and I set out to study all the possibilities with a spreadsheet. Once the spreadsheet was ...should I say built, specified, programmed, formulated? what does one do to make a spreadsheet one's need? Well, the spreadsheet was easily extended to consider the days of the week that recurring holidays fell, to compute the *good* years for holidays, the *lean* years for holidays, and, what really annoys me, the years holidays fall on Saturday! Why is it a problem that holidays fall on Saturday? Stores are closed on a day I normally am free to shop.

Back to the question of XIIIths: simply put, months occur in the same order every year, and other than February have the same number of days every year. Thus, there are only fourteen possible cases to consider, depending on the day the year starts, and how many days February has (leap year or not). For instance, January 13th will fall the fifth weekday after January 1, since the 15th (and 8th, 22nd, and 29th) fall on the same weekday as the 1st. If the year begins on Sunday, the 13th will fall on Friday; if the year begins any other weekday, January is *safe*!

In the same way, we can determine the offset for the 13th of each of the following months. January has 31 days, which is 3 more than 28 (i.e. modulo 7). Since Jan 13th falls the fifth weekday after the 1st, and the 13th of Feb will fall 31 days later, it will fall on the eighth weekday after the 1st, which is also the next weekday after the 1st. And so we go, accumulating modulo 7...

With this table, we can now answer our questions. Better yet, we can derive another table! This one will tell us how many times each offset occurs in a year, leap or otherwise. Why does this interest us? Because every offset occurs at least once a year, so no matter what weekday the year starts, there will always be at least one Friday XIII. And there will be at most three, in non-leap years starting on Thursday: February, March, and November each have offset="1". Shall we check? Fridays are Jan 2, 9, 16, 23, 30, 37 (=Feb 6), Feb 13! And March 13, since February has 28 days in non-leap years. Trust me for November?

Offset "0" means the 13th falls the same day of the week as January 1; if the year started on Friday, the month with offset 0 will have a Friday XIII. Similarly, offset "6" means the sixth day after, or, equivalently, the day before; if the year began on Saturday, the month with offset 6 will have a Friday XIII.

This year, MMV for most Europeans, began on Saturday and is not a leap-year. It has one Friday XIII, in May.

Stumble It!

Back to the question of XIIIths: simply put, months occur in the same order every year, and other than February have the same number of days every year. Thus, there are only fourteen possible cases to consider, depending on the day the year starts, and how many days February has (leap year or not). For instance, January 13th will fall the fifth weekday after January 1, since the 15th (and 8th, 22nd, and 29th) fall on the same weekday as the 1st. If the year begins on Sunday, the 13th will fall on Friday; if the year begins any other weekday, January is *safe*!

In the same way, we can determine the offset for the 13th of each of the following months. January has 31 days, which is 3 more than 28 (i.e. modulo 7). Since Jan 13th falls the fifth weekday after the 1st, and the 13th of Feb will fall 31 days later, it will fall on the eighth weekday after the 1st, which is also the next weekday after the 1st. And so we go, accumulating modulo 7...

### Offsets From January 1 to 13th of Each Month

----- | Leap Years | Non-Leap Years | ||||

Month | Days | Mod 7 | Offset | Days | Mod 7 | Offset |

Jan | 31 | 3 | 5 | 31 | 3 | 5 |

Feb | 29 | 1 | 1 | 28 | 0 | 1 |

Mar | 31 | 3 | 2 | 31 | 3 | 1 |

Apr | 30 | 2 | 5 | 30 | 2 | 4 |

May | 31 | 3 | 0 | 31 | 3 | 6 |

Jun | 30 | 2 | 3 | 30 | 2 | 2 |

Jul | 31 | 3 | 5 | 31 | 3 | 4 |

Aug | 31 | 3 | 1 | 31 | 3 | 0 |

Sep | 30 | 2 | 4 | 30 | 2 | 3 |

Oct | 31 | 3 | 6 | 31 | 3 | 5 |

Nov | 30 | 2 | 2 | 30 | 2 | 1 |

Dec | 31 | 3 | 4 | 31 | 3 | 3 |

With this table, we can now answer our questions. Better yet, we can derive another table! This one will tell us how many times each offset occurs in a year, leap or otherwise. Why does this interest us? Because every offset occurs at least once a year, so no matter what weekday the year starts, there will always be at least one Friday XIII. And there will be at most three, in non-leap years starting on Thursday: February, March, and November each have offset="1". Shall we check? Fridays are Jan 2, 9, 16, 23, 30, 37 (=Feb 6), Feb 13! And March 13, since February has 28 days in non-leap years. Trust me for November?

### Number of Occurences of Offsets from Jan 1 to the 13th of a Month

Offset | In Leap Years | In Non-Leap Years |

0 | 1 | 1 |

1 | 2 | 3 |

2 | 2 | 1 |

3 | 1 | 2 |

4 | 2 | 2 |

5 | 3 | 2 |

6 | 1 | 1 |

Offset "0" means the 13th falls the same day of the week as January 1; if the year started on Friday, the month with offset 0 will have a Friday XIII. Similarly, offset "6" means the sixth day after, or, equivalently, the day before; if the year began on Saturday, the month with offset 6 will have a Friday XIII.

This year, MMV for most Europeans, began on Saturday and is not a leap-year. It has one Friday XIII, in May.

Stumble It!