The days of the week (d.o.w) which are Sunday, Monday,
Tuesday,Wednesday,Thursday,Friday and Saturday (in that order) are respectively denoted by the numbers 0,1,2,3,4,5 and 6 . Any given year commencing with a particular d.o.w is assigned that value corresponding to that d.o.w. For example, the value ‘0’ would be assigned to a year commencing with a Sunday.
# A year is defined as ‘Matched’ if the remainder obtained, when the year is divided by 7, corresponds precisely with the value assigned to that particular year. For example, 2003 A.D. is NOT A Matched year since 2003 leaves a remainder of 1 upon division by 7 but January 1,2003 occurred on a Wednesday which is denoted by 3.
Determine the total number of ‘Matched’ years between 1960 A.D. and 2560 A.D.(both years inclusive) in accordance with the Western (Gregorian) Calendar System.
Instead of considering two values (the dow value and the year value), let's just consider the year minus the dow, mod 7. Let's just call this the xvalue of a year. When the xvalue is 0, the year is matched.
As each normal year passes, the xvalue doesn't change. However, after leap years, the xvalue increases by 1, mod 7.
Starting from 2003, which has a xvalue of 5 from the given information. Let's go back 43 years, 10 of which are leap years. The xvalue of 1960 is 1. As we go through the years, the xvalue makes a pattern:
1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5...
This pattern continues, except on years 2100, 2200, 2300, and 2500, which are not leap years. Of these exception years, only 2300 and 2500 are matched years. So, we can add 8 matched years to the final answer if we were to calculate up to year 2544 without any exceptions.
The first set of matched years is 19811984. Groups of 4 occur every 28 years. There are 20 cycles of 28 years from 1981 to 2544, along with the first 4 years of the next cycle, all of which are matched.
So... 20*4+4+8 = 92 matched years
I probably miscalculated somewhere, but I don't really care. It's the process that's important, not the answer.

Posted by Tristan
on 20060122 15:43:38 