Robbie Hatley's Solutions To The Weekly Challenge #227
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle, usually with two parts, cycling every Sunday. You can find it here: The Weekly Challenge This week (2023-07-23 through 2023-07-29) is weekly challenge #227. Task 1 is as follows: Task 1: Friday 13th Submitted by: Peter Campbell Smith You are given a year number in the range 1753 to 9999. Write a script to find out how many dates in the year are Friday 13th, assuming that the current Gregorian calendar applies. Example: Input: $year = 2023 Output: 2 Since there are only 2 Friday 13th in the given year 2023, i.e. 13th Jan and 13th Oct. Let's use the number 0-6 to stand for days-of-week from a Sunday through the next Saturday. Because we're only interested in years 1753+, lets use 13 December 1752 as "epoch". That was a Wednesday, so our starting offset is 3. Then make an array to hold elements indexed from 1753 through 9999 (representing the years), with element ...