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.

The required number of ‘Matched’ years between 1960 A.D. and 2560 A.D. (both years inclusive) is 84.

ANALYTIC SOLUTION (Submitted By Charlie)

For any series of years in which there is a leap year every four years, there is a 28-year cycle that repeats, as the 4-year cycle of leap years is relatively prime to the 7 that is the number of days in the week. So during this period each beginning day of the week and each year remainder (and their combinations) are represented equally, so four out of the 28 are 'matched'. A first approximation to an answer would be (2560-1959) * 4 / 28 ~= 86. However, the fractional cycles need be accounted for.

The 4-year cycle of leap years is interrupted in years ending in 00, but are not divisible by 400. In the time period referenced, these are 2100, 2200, 2300 and 2500. Each of these is a common, rather than leap, year, even though divisible by 4.

From 1960 through 2100 inclusive, is 141 years, or one more than 5 * 28. The five 28- year cycles account for 5 * 4 = 20 matches. As the 1960 and 2100 are both at the same position in the 28-year cycle, they are either both matches or both non-matches, so either one can be considered as the extra year (the break in the cycle comes in February, 2100, so Jan 1 is not affected). We'll use 2100: it is 97 years after 2003, or 24 4-year cycles plus 1 year. 24 4-year cycles advance the dow by 24*5 mod 7 = 1. The extra year, being non-leap (Feb. 2003 or Feb 2099) advances one more day, making a total of 2 days. So Jan 1, 2100 is a Friday (dow=5). But 2100 mod 7 = 0, so there is no match. Therefore 1960 through 2100 accounts for just the 20 matches of its five full 28-year cycles.

Then comes 2101 through 2200. Year 2101's dow is 1 past that of 2100 as the latter is non-leap. That makes its dow=6. Its remainder mod 7 is 1. One hundred years is 3*28 + 16. The three 28-year cycles account for 3*4=12 match years. We need the extra 16, which might as well be the first 16:

Thus these years account for four matches, making the total for 2101 through 2200 equal to 16 matches.

Then come 2201 through 2300. Again there are three 28-year cycles accounting for 12 match years, and again we do the first 16 as extra. As the last of the extra 16 years above, we had calculated dow = 3 for year 2116. So year 2200 also has dow = 3, and 2201 has dow = 4, since 2201 is not a leap year. Also, 2201 mod 7 is 3, so the extra 6 years of this cycle have:

This yields no matches, so 2201 through 2300 account for just 12 match years. Then years 2301 through 2500 (a 200-year span as 2400 is indeed a leap year) are done similarly. Year 2300 has dow = 1 and 2301 has dow = 2, and 2301 mod 7 = 5, and the span includes 7 28-year cycles plus 4 extra years:

dow: 2 3 4 5
remainder: 5 6 0 1
so no matches are in the extra years, but the 7 28-year cycles give 28 matches, which is then the total for years 2301 through 2500.

Finally, we have 2501 through 2560. These 60 years are two 28-year cycles plus four more years. As 2500 is non-leap, 2501 has dow one higher than that of 2500 (remember that extra years have matching characteristics at the front or at the end of any span):

dow: 6 0 1 2
remainder: 2 3 4 5
for no matches, but the two 28-year cycles give 8 matches.

So we have 20 + 16 + 12 + 28 + 8 = 84 as the final answer.

COMPUTER SOLUTION (Submitted By Charlie )

We have 84 as the final answer.

This is confirmed by the following program:

CLS
FOR y = 1960 TO 2560

mo = 1: da = 1: ye = y
GOSUB greg.to.jd
dow = (jd + 1) MOD 7
PRINT y; dow; y MOD 7

IF dow = y MOD 7 THEN ct = ct + 1

NEXT y
PRINT ct

END

greg.to.jd:
10100 REM :greg mo/da/ye --> jd at noon
10110 GOSUB jul.to.jd
10120 jd = jd + 2 - INT(cw(1) / 100) + INT(cw(1) / 400)
10130 RETURN
jul.to.jd:
10150 REM :jul mo/da/ye --> jd at noon
10160 cw(0) = mo: cw(1) = ye: IF mo < 3 THEN cw(0) = mo + 12: cw(1) = ye – 1
10170 jd = INT(365.25 * cw(1)) + INT(30.61 * (cw(0) + 1)) + da + 1720995!
10180 RETURN

The line numbers are left over from an ancient version of Basic. Julian day numbers are used in astronomy and count days from 4713 BC.