| |
BGonline.org Forums
Friday the 13th
Posted By: Nack Ballard In Response To: Friday the 13th (Casper van der Tak)
Date: Tuesday, 17 May 2011, at 4:19 p.m.
Is there a clever shortcut in working this out, or do you need to rely on brute force?
Shortcuts are certainly available, though I wouldn't call the entire process "quick."
There are 14 different calendars. If you label the days of the week Sunday = 0, Monday = 1, etc., and represent the 13ths of the month in a 12-string starting with January, the year 2001 looks like this:
62 2503514624
Add 1 to each of these numbers (where 6 goes "up" to 0) and you get a different calendar (the one for 2002, actually). Keep adding 1 until you have 7 calendars. Then start over by adding 1 only to the 10 digits on the right (62 3614625035) to get a leap-year calendar, then add 1 to all 12 and repeat six times to get the other six leap-year calendars.
For the 14 calendar representations now before you, count the number of 5s (Fridays) in each row, the quantities of which can be reduced to this grid:
2 2
2 1
1 2
3 2
1 1
1 1
2 3We'll number the calendars in the left column 1 through 7, and the calendars in the right column (the leap years) 1L through 7L. Listing the calendar for 2001, followed by 2002, etc., you get
1
2
3
4L
6
7
1
2L
4
5
6
7L, etc.Notice the pattern (based on 365/7 yielding a remainder of 1). The calendar number goes up by 1 (with an L every four) but jumps 2 after a leap, while the Ls go down by 2 each leap cycle (except for the years 2100, 2200, and 2300 when there is no leap year and the regular year rises by only 1).
As the cycle pattern mostly repeats, it is easy enough to combine, thereby considerably speeding up the tally. No doubt the whole thing can be "reduced" to one gangly formula, but it might not be worthwhile to do so unless dealing with a more sophisticated calendar (the Gregorian is off a day every few thousand years, as I recall).
Beginning the 400-year cycle in January 2001 is arbitrary other than convenience. You'll arrive at the same answer at whatever point in time you choose to start.
Hope that helps.
-Nack
| |
BGonline.org Forums is maintained by Stick with WebBBS 5.12.