Friday the 13th comes on a Friday this month

Many years ago, I wrote about how many Friday the 13ths you can have in a year. At some point in the intervening decade, I read that the 13th of the month occurs more often on Friday than any other weekday, but I never checked up on it. This morning I did.

As in my last post, I fired up Mathematica to do a brute force solution. I generated a list of the weekdays associated with the 13th of every month over a 400-year Gregorian calendar cycle:

f13 = Flatten[
       Table[
         DateValue[
           DateObject[{y, m, 13}],
           "ISOWeekDay"],
         {y, 1801,2200},
         {m, 1, 12}]]

The Table command makes a nested list of weekday values of every month of every year from 1801 through 2200 (any 400-year period would do). Flatten then flattens it into a single list of 4800 values. With this list, we can get the counts of each weekday:

KeySort[Counts[f13]]

The results are

<|1 -> 685, 2 -> 685, 3 -> 687, 4 -> 684,
  5 -> 688, 6 -> 684, 7 -> 687|>

You may recall from last time that the ISOWeekDay values are 1 for Monday through 7 for Sunday. So 13ths are ever-so-slightly more likely to fall on a Friday (5) than on any other weekday.