Calculating future occurrences of Friday the 13th

前端 未结 7 1772
庸人自扰
庸人自扰 2020-12-15 12:48

I\'d like to be able to start with a year, and calculate occurrences of Friday the 13th. A brute force solution is easy and obvious. I have something slightly better, but

7条回答
  •  青春惊慌失措
    2020-12-15 13:37

    One thing I noticed is that the first of the month falls on a Sunday during months with a Friday the 13th. You can probably leverage this to make it easier to calculate.

提交回复
热议问题