The jd in the below program is the Julian Day Number, a sequential count of days since January 1, 4713 BC Julian. Per the Wikipedia article: "Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC proleptic Julian calendar. (November 24, 4714 BC in the proleptic Gregorian calendar.) The Julian day number for 23 July 2012 is 2456132."
DEFDBL AZ
CLS
OPEN "succsund.txt" FOR OUTPUT AS #2
FOR y = 2001 TO 2100
ye = y: mo = 1: da = 1
GOSUB greg.to.jd
dow = (jd + 1) MOD 7 ' sunday = 0 thru 6=saturday
jd = jd + ((7  dow) MOD 7)' go to first sunday
jd0 = jd: sunCt = 1
hitnow = 0
DO
GOSUB jd.to.greg
IF sunCt = da AND ye = y THEN
hitnow = 1
hitCt = hitCt + 1
IF y <= 2028 OR y = 2100 THEN
PRINT ye; mo; da
PRINT #2, ye; mo; da
IF y <= 2028 THEN hitCtAux = hitCtAux + 1
END IF
END IF
jd = jd + 7: sunCt = sunCt + 1
LOOP UNTIL sunCt > 31
IF y <= 2028 AND hitnow = 1 THEN PRINT : PRINT #2,
NEXT y
PRINT hitCtAux
PRINT hitCt
PRINT #2, hitCtAux
PRINT #2, hitCt
CLOSE
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
jd.to.greg:
10200 REM:noon jd>greg mo/da/ye
10210 cw(0) = INT((jd  1867216.25#) / 36524.25)
10220 cw(0) = jd + 1 + cw(0)  INT(cw(0) / 4)
10230 GOTO common.from.jd
jd.to.jul:
10240 REM : noon jd>jul mo/da/ye
10250 cw(0) = jd
common.from.jd:
10260 cw(0) = cw(0) + 1524
10265 cw(1) = INT((cw(0)  122.1) / 365.25)
10270 cw(2) = INT(365.25 * cw(1))
10275 cw(3) = INT((cw(0)  cw(2)) / 30.6001)
10280 da = cw(0)  cw(2)  INT(30.61 * cw(3))
10285 ye = cw(1)  4716
10290 mo = cw(3)  1: IF mo > 12 THEN mo = mo  12: ye = ye + 1
10295 RETURN
As shown below, any given year can have from zero to three succinct Sundays.
As 28 years constitutes a basic cycle which repeats except for most century years, including 2100, the first 28 years are shown here:
year mo day
2001 4 15
2001 5 20
2002 3 10
2005 2 6
2005 6 26
2005 7 31
2006 1 1
2006 4 16
2006 5 21
2007 4 15
2007 5 20
2011 2 6
2011 6 26
2011 7 31
2012 1 1
2012 3 11
2013 3 10
2016 6 26 *
2016 7 31 *
2017 1 1
2017 4 16
2017 5 21
2018 4 15
2018 5 20
2019 3 10
2022 2 6
2022 6 26
2022 7 31
2023 1 1
2023 4 16
2023 5 21
2024 3 10
2028 2 6
2028 4 16
2028 5 21
There are 35 succinct Sundays in this cycle and in each successive full cycle of the given century. The 100year period has three of these 28year cycles plus an additional 16 years. The last 16 years would repeat the 19 succinct Sundays of the first 16 years of the cycle, except that 2100 will be a nonleap year, unlike 2016, marked with asterisks above, so that the 26th and 31st Sundays of that year will not be succinct, and in fact that year has no succinct Sundays (2100 is a nonleap year beginning on a Friday, like 2010, 2021 and 2027, which also contain no succinct Sundays), and so instead of adding 19 to the count of 35*3, we just add 17, making 122, as also shown by the counts made by the program:
35
122 (answer to part i)
where the 35 is for the first cycle of 28 years (and thus also for each of the two remaining full 28year cycles) and the 122 for the full 100 years.
Part ii:
The largest number of succinct Sundays in a year, 3, occurs in 2005, 2006, 2011, 2017, 2022, 2023 and 2028. As the cycle repeats every 28 years until interrupted by the irregular year 2100, we can add multiples of 28 to each of these year numbers: 2033, 2034, 2039, 2045, 2050, 2051, 2056, 2061, 2062, 2067, 2073, 2078, 2079, 2084, 2089, 2090, 2095.
Part iii:
The first Succinct Sunday in the given period is, as shown above, 2001 April 15.
As the period ends on the 16th year of a cycle as defined here, the last Succinct Sunday would be in the 13th year of that cycle, corresponding to the event of 2013. The year would be 2013 + 3*28 = 2097, and as in 2013 will be on March 10.

Posted by Charlie
on 20120723 15:45:46 