In which our heroine, having defeated the three-headed demon of supercomputing, optimization, and ill-posed problems in her quest for the elusive Ph.D., embarks upon her new career.

Wednesday, January 12, 2011

Adventures in Calendars

Yesterday I was talking about the fact that sufficient time has elapsed from the arbitrarily set starting point of our calendar system such that the date was filled with ones. I have always been very interested in numbers, and starting when I was about Vinny's age, calendars were a big obsession. I had my own perpetual calendar which I regularly studied. I pored over it, seeking patterns in the days and months -- for example, my sister's birthday in April predicted the day of the week upon which both my September birthday and Christmas would subsequently fall.

That's why, when I saw the following on a Facebook friend's status, I had to respond:

I'm not superstitious, but this year July has 5 Fridays, 5 Saturdays and 5 Sundays. This happens once every 823 years. This is called money bags. So, copy this to your status and money will arrive within 4 days. Based on Chinese Feng Shui. The one who does not copy.....will be without money.

This July will indeed have five Fridays, Saturdays, and Sundays, but this is a frequent occurrence -- once every seven years, on average.

If you think about it, you can see why. The reason July will have five Fridays, Saturdays, and Sundays is because the month will start on a Friday this year. The day of the week July starts on is determined by what day January 1 is and whether it is a leap year. There are fourteen unique calendars -- the year can start on one of seven days, and times two because it could be a regular year or a leap year.

There are 365 days in a (non-leap) year. A week consists of seven days, so there are 365/7 = 52 weeks plus one day in a year. This means that the next year begins one day of the week later than the current year. The year that follows a leap year begins two days later. So, this year (2011) began on a Saturday, next year (2012, leap year) begins on a Sunday, and the year after that (2013) begins on a Tuesday.

Non-leap years that begin on Saturday produce Julys with five three-day weekends. So do leap years that begin on Friday (because that extra day occurs before July). Thus there are two out of the fourteen possible calendars that exhibit this phenomenon.

But at what frequency do these calendars occur? After all, there could be some calendars that occur more frequently than others. Obviously, leap calendars are less frequent than regular calendars, but all leap and regular calendars occur with the same frequency as their counterparts. In fact, there is a 28-year calendar cycle that is easily generated.

Let's code the days of the week as follows: Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6. We can denote the year starting with a given day of the week with the corresponding number.

If there were no leap years, the sequence would look like this:
0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6...

However, there are leap years, so the sequence gets interrupted once every four years. Let's denote leap years with a prime (') and the color red:
0, 1, 2, 3', 5, 6, 0, 1', 3, 4, 5, 6', 1, 2, 3, 4', 6, 0, 1, 2', 4, 5, 6, 0', 2, 3, 4, 5'
(at this point we start over with 0, 1, 2...)

If you count it up, there are three of each of the years 0 to 6 in this 28-year span, and one of each leap year. So, if we count up the number of sixes and five-primes in the sequence (years with five three-day weekends in July), we get four out of 28, or one in seven.

So, I'm sorry, Facebook friend, but this phenomenon occurs on average once out of every 7 years, more than 100 times more frequently than you have asserted. Your post will be as effective as all the other forms of feng shui -- in other words, completely ineffective. But, at least it gave me something interesting to write about!

Disclaimer

The events described in this blog are fictitious. Any similarity to any person living or dead is merely coincidental. The opinions expressed herein are my own, and do not reflect those of my (fictitious?) employer.