📅
Friday 13th
Week 7
It's Jan 1st 0001 and and you are living in a country ruled by a mad king with an intense triskaidekaphobia - the fear of the number 13
As a result, they claim that the king of the country shall never work on a Friday the 13th - they claim it's for superstitious reasons, but you suspect it's just a good excuse to take some extra days off
You have hence been ordered to find all the Friday 13ths from the year 0001 to 9999
The dates should be in the hyphen-separated format YYYY-MM-DD, with each date being be on a new line
With a king as mad as this one, you need to get to work straight away - else you can only imagine your fate
Note: due to quirks with JavaScript dates, it's recommended not to use this language for this challenge - the same issues will also exist on pseudocode.pro, since that uses the browser's JavaScript date class under the hood too
Hints
Hints will be released at the start of each of the following days - e.g. the start of day 3 is 48 hours after the challenge starts
| Release Day | Hint |
|---|---|
| 2 | If going for a brute force approach, you probably want to loop through both the years and months |
| 3 | Since you are looping through all the years, then each month for that year, you will probably want a nested loop |
| 4 | Looping through the years should be the outer loop, while looping through the months should be the inner loop |
| 5 | Most programming languages have a built-in date function to get the day index (e.g. Monday = 0, Tuesday = 1 etc) - check the exact behaviour (starting day/index values for your particular language) |