# How many Friday 13th's in a list? [duplicate]

Take a list of all dates between 1st January 1920 and 1st January 2020. How many Fridays 13th's are there in that list?

Using Wolfram 12.1

Count[Friday][DayName /@ Tuples[{Range[1920, 2019], Range[12], {13}}]]
Array[Boole[Friday == DayName[{#, #2, 13}]] &, {100, 12}, {1920, 1}, Plus]
Total[Array[Boole[Friday == DayName[{1919 + #, #2, 13}]] &, {100, 12}], 2]
Count[Friday]@ Flatten@Table[DayName[{y, m, 13}], {y, 1920, 2019}, {m, 1, 12}]
(i = 0; Do[i += Boole[Friday == DayName[{y, m, 13}]], {y, 1920, 2019}, {m, 1,  12}]; i)
Count[Friday]@Flatten@Table[DayName[{1920, m, 13}], {m, 1, 12 100}]
Count[Friday][DayName /@ DateRange[{1920, 1, 13}, {2019, 12, 13}, "Month"]]
Counts[DayName /@ DateRange[{1920, 1, 13}, {2019, 12, 13}, "Month"]]@Friday
Count[_?(DayName@# == Friday &)]@DateRange[{1920, 1, 13}, {2019, 12, 13}, "Month"]


all give

173


The first 6 are similar in speed. They are more than twice as fast as the last 3. RepeatedTimings are:

{0.11, 0.12, 0.11, 0.11, 0.11, 0.11, 0.262, 0.262, 0.265}


In comparison, RepeatedTiming for DateRange[start, end, Friday] // Select[blackFridayQ] // Length is 5.4.

start = DateObject[{1920, 1, 1}];
end = DateObject[{2020, 1, 1}];
blackFridayQ[date_] := DateValue[date, "Day"] == 13
DateRange[start, end, Friday] // Select[blackFridayQ] // Length


173