A company decides that whenever Xmas falls on a Sunday they will give their workers all extra paid holidays so that, together with any public holidays, workers will not have to work the following week (between the 25th of December and the first of January).



Task

In what years between 2008 and 2121 will the 25th of December be a Sunday?

Using any standard date handling libraries of your programming language;
compare the dates calculated with the output of other languages to discover any anomalies in the handling of dates which may be due to, for example, overflow in types used to represent dates/times similar to   y2k   type problems.




 
PROGRAM DAY_OF_THE_WEEK
 
PROCEDURE MODULO(X,Y->RES)
   IF Y=0 THEN
      RES=X
     ELSE
      RES=X-Y*INT(X/Y)
   END IF
END PROCEDURE
 
PROCEDURE WD(M,D,Y->RES%)
   IF M=1 OR M=2 THEN
     M+=12
     Y-=1
   END IF
   MODULO(365*Y+INT(Y/4)-INT(Y/100)+INT(Y/400)+D+INT((153*M+8)/5),7->RES)
   RES%=RES+1.0
END PROCEDURE
 
BEGIN
PRINT(CHR$(12);) ! CLS
FOR YR=2008 TO 2121 DO
    WD(12,25,YR->RES%)
    IF RES%=1 THEN  ! day 1 is Sunday......
      PRINT("Dec";25;",";YR)
    END IF
END FOR
GET(K$)
END PROGRAM
 