Friday the 13th! | Accidental Scientist

Friday the 13th!

Today is the 2nd Friday 13th of 2009. There’s actually three. (Spooky eh? Well… spooky if you’re paraskevadecatriaphobic maybe).

Just so you don’t need to worry any more, here’s a C# program, so you can figure out when it’s going to happen again.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Friday13th
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1601; i < 2500; ++i)
            {
                int fricount = 0;
                for (int j = 1; j < 12; ++j)
                {
                    DateTime dt = new DateTime(i, j, 13);
                    if (dt.DayOfWeek == DayOfWeek.Friday)
                    {
                        fricount++;
                    }
                }

                if (fricount > 2)
                {
                    Console.Out.WriteLine("{0} has {1} Friday 13ths…", i, fricount);
                }
            }
        }
    }
}

Now, of course, this program only dumps out the years which have three of them, which is actually not all that many. In fact those poor souls who are tri-paraskevadecatriaphobic have had a relatively free ride since 1998 – this being the first year since then that we’ve had three in a year.

Unfortunately, the next few years are going to be rough for those poor souls, because it happens again and again – next time is 2012, then 2015, then a period of respite until 2026.

Good thing I’m not superstitious. (Touch wood). Here’s the output of the program for the next few centuries.

2009 has 3 Friday 13ths… 2012 has 3 Friday 13ths… 2015 has 3 Friday 13ths… 2026 has 3 Friday 13ths…
2037 has 3 Friday 13ths… 2040 has 3 Friday 13ths… 2043 has 3 Friday 13ths… 2054 has 3 Friday 13ths…
2065 has 3 Friday 13ths… 2068 has 3 Friday 13ths… 2071 has 3 Friday 13ths… 2082 has 3 Friday 13ths…
2093 has 3 Friday 13ths… 2096 has 3 Friday 13ths… 2099 has 3 Friday 13ths… 2105 has 3 Friday 13ths…
2108 has 3 Friday 13ths… 2111 has 3 Friday 13ths… 2122 has 3 Friday 13ths… 2133 has 3 Friday 13ths…
2136 has 3 Friday 13ths… 2139 has 3 Friday 13ths… 2150 has 3 Friday 13ths… 2161 has 3 Friday 13ths…
2164 has 3 Friday 13ths… 2167 has 3 Friday 13ths… 2178 has 3 Friday 13ths… 2189 has 3 Friday 13ths…
2192 has 3 Friday 13ths… 2195 has 3 Friday 13ths… 2201 has 3 Friday 13ths… 2204 has 3 Friday 13ths…
2207 has 3 Friday 13ths… 2218 has 3 Friday 13ths… 2229 has 3 Friday 13ths… 2232 has 3 Friday 13ths…
2235 has 3 Friday 13ths… 2246 has 3 Friday 13ths… 2257 has 3 Friday 13ths… 2260 has 3 Friday 13ths…
2263 has 3 Friday 13ths… 2274 has 3 Friday 13ths… 2285 has 3 Friday 13ths… 2288 has 3 Friday 13ths…
2291 has 3 Friday 13ths…

About Simon Cooke

Simon Cooke is a video game developer, ex-freelance journalist, screenwriter, film-maker and all-round good egg in Seattle, WA. The views posted on this blog are his and his alone, and have no relation to anything he's working on, his employer, or anything else and are not an official statement of any kind.
facebook comments