Any month that starts on Sunday has Friday the thirteenth. There are only 14 combinations, possibly knowing which day the first year is (with or without a leap year and with the sun). You just need to calculate it once and get it. You would only check 14 * 12 possible months to start with, well, given the reasons.
result element of the table (since 2009, 2010):
[Thursday,false] => Feb, March, Nov [Friday,false] => Aug
to fill out the table, you have the common month Jan (31), Feb (28) .. and then iterate with the seed of each day of the week, marking months starting on Sunday, as well as with and without a leap year. Pretty straight forward, and once you're done, you can share it with us :)
nlucaroni
source share