Holidays related to Easter

From Rosetta Code
Revision as of 17:43, 1 December 2010 by rosettacode>Abu (Using 'easter' from "lib/cal.l")
Task
Holidays related to Easter
You are encouraged to solve this task according to the task description, using any language you may know.

Calculate the date of Easter, Ascension Thursday, Pentecost, Trinity Sunday & Corpus Christi feast.

As the example calculate for the first year of each century from 400 to 2100 CE and also for years 2010 to 2020 CE.

Note: From year 325 CE on, Easter Sunday is the Sunday following the first Ecclesiastical full moon not earlier than the equinox date in 325 — 21 March. The Ecclesiastical full moon does not always correspond to the astronomical full moon since in 325 fine details of Lunar dynamics were not yet fully understood.

Metonic cycle: Taking a year to be 1/19th of this 6940-day cycle gives a year length of 365 + 1/4 + 1/76 days (the unrounded cycle is much more accurate), which is slightly more than 12 synodic months. To keep the 12-month lunar year in pace with the solar year, an intercalary 13th month would have to be added on seven occasions during the nineteen-year period. Meton introduced a formula for intercalation in circa 432 BC.

ALGOL 68

Works with: ALGOL 68 version Revision 1 - no extensions to language used
Works with: ALGOL 68G version Any - tested with release 1.18.0-9h.tiny

Note: Base code specimen extracted from Algol 68 Genie Documentation Part III - Example a68g programs. <lang algol68>MODE YEAR = INT, MONTH = INT, WEEK = INT, DAY = INT;

MODE DATE = STRUCT(

 YEAR year,  #DAY year day, #
 MONTH month, DAY month day,#
 WEEK week,  #DAY week day);

FORMAT mon fmt = $c("Jan", "Feb", "Mar", "Apr", "May", "Jun",

                        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")$,

FORMAT week day fmt = $c("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri")$;

PROC year days = (YEAR year)DAY: # Ignore 1752 CE for the moment #

 ( month days(year, 2) = 28 | 365 | 366 );

PROC month days = (YEAR year, MONTH month) DAY:

 ( month | 31,
           28 + ABS (year MOD 4 = 0 AND year MOD 100 /= 0 OR year MOD 400 = 0),
           31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

MONTH year months = 12; DAY week days = 7; # France 1793 to 1805 had 10 day weeks! #

OP + = (DATE in date, DAY in days)DATE:

   BEGIN # todo: eliminate loops, handle year <= 1752 #
      DAY days := in days;
      DATE date := in date;
   # Normalize the days to be less then 1 year #
      WHILE days < 0 DO
        year OF date -:= 1;
        days +:= year days(year OF date)
      OD;
      WHILE days > year days(year OF date) DO
        days -:= year days(year OF date);
        year OF date +:= 1
      OD;
      month day OF date +:= days;
   # Normalize the days to be the same month #
      WHILE month day OF date > month days(year OF date, month OF date) DO
         month day OF date -:= month days(year OF date, month OF date);
         month OF date +:= 1;
         IF month OF date > year months THEN
            month OF date -:= year months;
            year OF date +:= 1
         FI
      OD;
      week day OF date := week day(date);
      date
   END;

OP +:= = (REF DATE date, DAY in days)DATE:

  date := date + in days;

PROC easter = (YEAR year)DATE:

  BEGIN
     COMMENT
        Easter date algorithm from J.M. Oudin (1940), reprinted in:
        P.K. Seidelmann ed., "Explanatory Supplement to the Astronomical
        Almanac" [1992] (Chapter 12, "Calendars", by L.E. Doggett)
     COMMENT
     DATE date; year OF date := year;
     INT c = year OVER 100, n = year MOD 19; # 19 years: Metonic cycle #
     INT i := (c - c OVER 4 - (c - (c - 17) OVER 25) OVER 3 + 19 * n + 15) MOD 30;
     i -:= (i OVER 28) * (1 - (i OVER 28) * (29 OVER (i + 1)) * ((21 - n) OVER 11));
     INT l = i - (year + year OVER 4 + i + 2 - c + c OVER 4) MOD 7;
     month OF date := 3 + (l + 40) OVER 44;
     month day OF date := l + 28 - 31 * (month OF date OVER 4);
     week day OF date := week day(date);
     date
  END;

PROC week day = (DATE date)DAY:

  # Zeller’s Congruence algorithm from 1887. #
  BEGIN
     INT year := year OF date, month := month OF date, month day := month day OF date, c;
     (month <= 2 | (month +:= 12, year -:= 1));
     c := year OVER 100;
     year MODAB 100;
     1 + (month day + ((month + 1) * 26) OVER 10
        + year + year OVER 4 + c OVER 4 - 2 * c) MOD 7
  END;

FORMAT wdmdm fmt = $f(week day fmt)z-dxf(mon fmt)$,

MODE EASTERRELATED = STRUCT(DATE easter, ascension, pentecost, trinity, corpus christi);

PROC easter related init = (YEAR year)EASTERRELATED: BEGIN

 DATE date;
 EASTERRELATED holidays;
  1. Easter date, always a Sunday. #
  easter OF holidays := date := easter(year);
  1. Ascension day is 39 days after Easter.#
  ascension OF holidays := ( date +:= 39);
  1. Pentecost is 10 days after Ascension day.#
  pentecost OF holidays := date +:= 10;
  1. Trinity is 7 days after Pentecost.#
  trinity OF holidays := date +:= 7;
  1. Corpus Christi is 4 days after Trinity.#
  corpus christi OF holidays := date +:= 4;
  holidays

END;

  1. Note: Y10K bug here... :-) #

FORMAT easter related fmt = $g(-4)" Easter: "f(wdmdm fmt) ", Ascension: "f(wdmdm fmt)

   ", Pentecost: "f(wdmdm fmt) ", Trinity: "f(wdmdm fmt)", Corpus: "f(wdmdm fmt)$;

PROC easter related print = (YEAR year)VOID: BEGIN

 EASTERRELATED holidays = easter related init(year);
 PROC wdmdm = (DATE date)STRUCT(DAY week day, DAY month day, MONTH month):
   (week day OF date, month day OF date, month OF date);
 printf((easter related fmt, year,
    wdmdm(easter OF holidays),  wdmdm(ascension OF holidays), wdmdm(pentecost OF holidays),
    wdmdm(trinity OF holidays), wdmdm(corpus christi OF holidays),
 $l$))

END;

printf (($"Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:"l$)); FOR year FROM 400 BY 100 TO 2100 DO easter related print(year) OD;

printf (($l"Christian holidays, related to Easter, for years from 2010 to 2020 CE:"l$)); FOR year FROM 2010 TO 2020 DO easter related print(year) OD</lang> Output:

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
 400 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
 500 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
 600 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
 700 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
 800 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
 900 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May
1000 Easter: Sun 30 Mar, Ascension: Thu  8 May, Pentecost: Sun 18 May, Trinity: Sun 25 May, Corpus: Thu 29 May
1100 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
1200 Easter: Sun  9 Apr, Ascension: Thu 18 May, Pentecost: Sun 28 May, Trinity: Sun  4 Jun, Corpus: Thu  8 Jun
1300 Easter: Sun 18 Apr, Ascension: Thu 27 May, Pentecost: Sun  6 Jun, Trinity: Sun 13 Jun, Corpus: Thu 17 Jun
1400 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
1500 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
1600 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
1700 Easter: Sun 11 Apr, Ascension: Thu 20 May, Pentecost: Sun 30 May, Trinity: Sun  6 Jun, Corpus: Thu 10 Jun
1800 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
1900 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
2000 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
2100 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May

Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
2011 Easter: Sun 24 Apr, Ascension: Thu  2 Jun, Pentecost: Sun 12 Jun, Trinity: Sun 19 Jun, Corpus: Thu 23 Jun
2012 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
2013 Easter: Sun 31 Mar, Ascension: Thu  9 May, Pentecost: Sun 19 May, Trinity: Sun 26 May, Corpus: Thu 30 May
2014 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
2015 Easter: Sun  5 Apr, Ascension: Thu 14 May, Pentecost: Sun 24 May, Trinity: Sun 31 May, Corpus: Thu  4 Jun
2016 Easter: Sun 27 Mar, Ascension: Thu  5 May, Pentecost: Sun 15 May, Trinity: Sun 22 May, Corpus: Thu 26 May
2017 Easter: Sun 16 Apr, Ascension: Thu 25 May, Pentecost: Sun  4 Jun, Trinity: Sun 11 Jun, Corpus: Thu 15 Jun
2018 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
2019 Easter: Sun 21 Apr, Ascension: Thu 30 May, Pentecost: Sun  9 Jun, Trinity: Sun 16 Jun, Corpus: Thu 20 Jun
2020 Easter: Sun 12 Apr, Ascension: Thu 21 May, Pentecost: Sun 31 May, Trinity: Sun  7 Jun, Corpus: Thu 11 Jun

C

Translation of: ALGOL 68
- note: This specimen retains the original ALGOL 68 coding style -

compare. <lang C>#include <stdio.h>

typedef int year_t, month_t, week_t, day_t;

typedef struct{

 year_t year; /* day_t year_day, */
 month_t month;  day_t month_day;/*
 week_t week, */ day_t week_day; } date_t;

char *mon_fmt[] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun",

                           "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

char *week_day_fmt[] = {"", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri"};

day_t month_days(year_t year, month_t month)

 { day_t days[]={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
   return (month==2) ? 28 + (( year % 4 = 0 && year % 100 != 0 ) || year % 400 == 0) : days[month];
 }

day_t year_days(year_t year) /* Ignore 1752 CE for the moment */

 { return (month_days(year, 2) == 28) ? 365 : 366; }

month_t year_months = 12; week_t week_days = 7; /* France 1793 to 1805 had 10 day weeks! */

date_t plusab(date_t *date, day_t days)

   { /* todo: eliminate loops, handle year <== 1752 */
   /* Normalize the days to be less then 1 year */
      while(days < 0){
        date->year -= 1;
        days += year_days(date->year);
      };
      while(days > year_days(date->year)){
        days -= year_days(date->year);
        date->year += 1;
      };
      date->month_day += days;
   /* Normalize the days to be the same month */
      while(date->month_day > month_days(date->year, date->month)){
         date->month_day -= month_days(date->year, date->month);
         date->month += 1;
         if(date->month > year_months){
            date->month -= year_months;
            date->year += 1;
         }
      }
      date->week_day = week_day(*date);
      return *date;
   }

date_t easter (year_t year)

  {
     /*
        Easter date algorithm from J.M. Oudin (1940), reprinted in:
        P.K. Seidelmann ed., "Explanatory Supplement to the Astronomical
        Almanac" [1992] (Chapter 12, "Calendars", by L.E. Doggett)
     */
     date_t date; date.year = year;
     int c = year / 100, n = year % 19; /* 19 years: Metonic cycle */
     int i = (c - c / 4 - (c - (c - 17) / 25) / 3 + 19 * n + 15) % 30;
     i -= (i / 28) * (1 - (i / 28) * (29 / (i + 1)) * ((21 - n) / 11));
     int l = i - (year + year / 4 + i + 2 - c + c / 4) % 7;
     date.month = 3 + (l + 40) / 44;
     date.month_day = l + 28 - 31 * (date.month / 4);
     date.week_day = week_day(date);
     return date;
  }

day_t week_day (date_t date)

  /* Zeller’s Congruence algorithm from 1887. */
  {
     int year = date.year, month = date.month, month_day = date.month_day, c;
     if(month <= 2){month += 12; year -= 1;}
     c = year / 100;
     year %= 100;
     return 1 + ((month_day + ((month + 1) * 26) / 10
        + year + year / 4 + c / 4 - 2 * c) % 7 + 7) % 7;
  }
  1. define wdmdm_fmt "%s %2d %s"

typedef struct{date_t easter, ascension, pentecost, trinity, corpus_christi;}easter_related_t;

easter_related_t easter_related_init (year_t year) {

  date_t date;
  easter_related_t holidays;

/* Easter date, always a Sunday. */

  holidays.easter = date = easter(year);

/* Ascension day is 39 days after Easter.*/

  holidays.ascension = plusab(&date, 39);

/* Pentecost is 10 days after Ascension day.*/

  holidays.pentecost = plusab(&date, 10);

/* Trinity is 7 days after Pentecost.*/

  holidays.trinity = plusab(&date, 7);

/* Corpus Christi is 4 days after Trinity.*/

  holidays.corpus_christi = plusab(&date, 4);
  return holidays;

}

/* note: y10k bug here... :-) */

  1. define easter_related_fmt "%4d Easter: "wdmdm_fmt", Ascension: "wdmdm_fmt\
   ", Pentecost: "wdmdm_fmt", Trinity: "wdmdm_fmt", Corpus: "wdmdm_fmt"\n"

void easter_related_print(year_t year) {

 easter_related_t holidays = easter_related_init(year);
  1. define wdmdm(date) week_day_fmt[date.week_day], date.month_day, mon_fmt[date.month]
 printf(easter_related_fmt, year,
   wdmdm(holidays.easter),  wdmdm(holidays.ascension), wdmdm(holidays.pentecost),
   wdmdm(holidays.trinity), wdmdm(holidays.corpus_christi));

}

main(){

 year_t year;
 printf ("Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:\n");
 for(year=400; year<=2100; year+=100){ easter_related_print(year); }
 printf ("\nChristian holidays, related to Easter, for years from 2010 to 2020 CE:\n");
 for(year=2010; year<=2020; year++){ easter_related_print(year); }

}</lang> Output:

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
 400 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
 500 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
 600 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
 700 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
 800 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
 900 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May
1000 Easter: Sun 30 Mar, Ascension: Thu  8 May, Pentecost: Sun 18 May, Trinity: Sun 25 May, Corpus: Thu 29 May
1100 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
1200 Easter: Sun  9 Apr, Ascension: Thu 18 May, Pentecost: Sun 28 May, Trinity: Sun  4 Jun, Corpus: Thu  8 Jun
1300 Easter: Sun 18 Apr, Ascension: Thu 27 May, Pentecost: Sun  6 Jun, Trinity: Sun 13 Jun, Corpus: Thu 17 Jun
1400 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
1500 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
1600 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
1700 Easter: Sun 11 Apr, Ascension: Thu 20 May, Pentecost: Sun 30 May, Trinity: Sun  6 Jun, Corpus: Thu 10 Jun
1800 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
1900 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
2000 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
2100 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May

Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
2011 Easter: Sun 24 Apr, Ascension: Thu  2 Jun, Pentecost: Sun 12 Jun, Trinity: Sun 19 Jun, Corpus: Thu 23 Jun
2012 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
2013 Easter: Sun 31 Mar, Ascension: Thu  9 May, Pentecost: Sun 19 May, Trinity: Sun 26 May, Corpus: Thu 30 May
2014 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
2015 Easter: Sun  5 Apr, Ascension: Thu 14 May, Pentecost: Sun 24 May, Trinity: Sun 31 May, Corpus: Thu  4 Jun
2016 Easter: Sun 27 Mar, Ascension: Thu  5 May, Pentecost: Sun 15 May, Trinity: Sun 22 May, Corpus: Thu 26 May
2017 Easter: Sun 16 Apr, Ascension: Thu 25 May, Pentecost: Sun  4 Jun, Trinity: Sun 11 Jun, Corpus: Thu 15 Jun
2018 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
2019 Easter: Sun 21 Apr, Ascension: Thu 30 May, Pentecost: Sun  9 Jun, Trinity: Sun 16 Jun, Corpus: Thu 20 Jun
2020 Easter: Sun 12 Apr, Ascension: Thu 21 May, Pentecost: Sun 31 May, Trinity: Sun  7 Jun, Corpus: Thu 11 Jun

C#

Works with: C sharp version 3.0

<lang csharp>using System; using System.Collections; using System.Collections.Specialized; using System.Linq;

internal class Program {

   private static readonly OrderedDictionary _holidayOffsets = new OrderedDictionary
                                                                   {
                                                                       {"Easter", 0},
                                                                       {"Ascension", 39},
                                                                       {"Pentecost", 49},
                                                                       {"Trinity", 56},
                                                                       {"Corpus", 60},
                                                                   };
   static void Main(string[] args)
   {
       Console.WriteLine("Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:");
       for (int year = 400; year <= 2100; year += 100)
           OutputHolidays(year);
       Console.WriteLine();
       Console.WriteLine("Christian holidays, related to Easter, for years from 2010 to 2020 CE:");
       for (int year = 2010; year <= 2020; year += 1)
           OutputHolidays(year);
   }
   static void OutputHolidays(int year)
   {
       var easter = CalculateEaster(year);
       var holidays = from kp in _holidayOffsets.OfType<DictionaryEntry>()
                      let holiday = easter.AddDays(Convert.ToInt32(kp.Value))
                      select kp.Key + ": " + string.Format("{0,2:ddd} {0,2:%d} {0:MMM}", holiday);
       Console.WriteLine("{0,4} {1}", year, string.Join(", ", holidays.ToArray()));
   }
   static DateTime CalculateEaster(int year)
   {
       var a = year % 19;
       var b = year / 100;
       var c = year %100;
       var d = b / 4;
       var e = b % 4;
       var f = (b + 8) / 25;
       var g = (b - f + 1) / 3;
       var h = (19 * a + b - d - g + 15) % 30;
       var i = c / 4;
       var k = c % 4;
       var l = (32 + 2 * e + 2 * i - h - k) % 7;
       var m = (a + 11 * h + 22 * l) / 451;
       var numerator = h + l - 7 * m + 114;
       var month = numerator / 31;
       var day = (numerator % 31) + 1;
       return new DateTime(year, month, day);
   }

} </lang>

Output:

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
 400 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
 500 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
 600 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
 700 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
 800 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
 900 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May
1000 Easter: Sun 30 Mar, Ascension: Thu  8 May, Pentecost: Sun 18 May, Trinity: Sun 25 May, Corpus: Thu 29 May
1100 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
1200 Easter: Sun  9 Apr, Ascension: Thu 18 May, Pentecost: Sun 28 May, Trinity: Sun  4 Jun, Corpus: Thu  8 Jun
1300 Easter: Sun 18 Apr, Ascension: Thu 27 May, Pentecost: Sun  6 Jun, Trinity: Sun 13 Jun, Corpus: Thu 17 Jun
1400 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
1500 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
1600 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
1700 Easter: Sun 11 Apr, Ascension: Thu 20 May, Pentecost: Sun 30 May, Trinity: Sun  6 Jun, Corpus: Thu 10 Jun
1800 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
1900 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
2000 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
2100 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May

Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
2011 Easter: Sun 24 Apr, Ascension: Thu  2 Jun, Pentecost: Sun 12 Jun, Trinity: Sun 19 Jun, Corpus: Thu 23 Jun
2012 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
2013 Easter: Sun 31 Mar, Ascension: Thu  9 May, Pentecost: Sun 19 May, Trinity: Sun 26 May, Corpus: Thu 30 May
2014 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
2015 Easter: Sun  5 Apr, Ascension: Thu 14 May, Pentecost: Sun 24 May, Trinity: Sun 31 May, Corpus: Thu  4 Jun
2016 Easter: Sun 27 Mar, Ascension: Thu  5 May, Pentecost: Sun 15 May, Trinity: Sun 22 May, Corpus: Thu 26 May
2017 Easter: Sun 16 Apr, Ascension: Thu 25 May, Pentecost: Sun  4 Jun, Trinity: Sun 11 Jun, Corpus: Thu 15 Jun
2018 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
2019 Easter: Sun 21 Apr, Ascension: Thu 30 May, Pentecost: Sun  9 Jun, Trinity: Sun 16 Jun, Corpus: Thu 20 Jun
2020 Easter: Sun 12 Apr, Ascension: Thu 21 May, Pentecost: Sun 31 May, Trinity: Sun  7 Jun, Corpus: Thu 11 Jun

J

Issues and Ambiguities

Caution: This task is currently self-contradictory, thus consistent results are impossible. See the talk page for some further discussion of this issue.

That said, the only calendar where the specified date range can be meaningful is the Julian calendar, which is currently used by Eastern Christianity for determining when to celebrate easter.

However, Corpus Christi is a Western Catholic holiday. Then again, Corpus Christi was not celebrated anywhere prior to the 13th century and in some countries it is celebrated on a Thursday and in other countries it is celebrated on a Sunday. So I have chosen to ignore this holiday for now.

In Eastern Christianity, Trinity Sunday is the same day as Pentecost.

Julian Easters

This code is based on the above rationale, and http://www.merlyn.demon.co.uk/estr-bcp.htm and the wikipedia pages referenced in the task description:

<lang j>jed=:3 :0

 pfm=. 21 + 30 | _4 + 19 * 1 + 19|y
 sn=. 6 - 7 | 4 + <.@*&1.25 y
 dys=. 1 40 50 50 +/~sn (] + 7 | 4 + -) pfm
 y,"0 1(+/\0 0 0 31 30 31 30) (I.,"0]-<:@I.{[) dys

)</lang>

Required example:

<lang j> jed (400 + 100* i.17),(2010 + i.11),2100</lang> output:

 400 4  1
 400 5 10
 400 5 20
 400 5 20

 500 4  2
 500 5 11
 500 5 21
 500 5 21

 600 4 10
 600 5 19
 600 5 29
 600 5 29

 700 4 11
 700 5 20
 700 5 30
 700 5 30

 800 4 19
 800 5 28
 800 6  7
 800 6  7

 900 4 20
 900 5 29
 900 6  8
 900 6  8

1000 3 31
1000 5  9
1000 5 19
1000 5 19

1100 4  1
1100 5 10
1100 5 20
1100 5 20

1200 4  9
1200 5 18
1200 5 28
1200 5 28

1300 4 10
1300 5 19
1300 5 29
1300 5 29

1400 4 18
1400 5 27
1400 6  6
1400 6  6

1500 4 19
1500 5 28
1500 6  7
1500 6  7

1600 3 23
1600 5  1
1600 5 11
1600 5 11

1700 3 31
1700 5  9
1700 5 19
1700 5 19

1800 4  8
1800 5 17
1800 5 27
1800 5 27

1900 4  9
1900 5 18
1900 5 28
1900 5 28

2000 4 17
2000 5 26
2000 6  5
2000 6  5

2010 3 22
2010 4 30
2010 5 10
2010 5 10

2011 4 11
2011 5 20
2011 5 30
2011 5 30

2012 4  2
2012 5 11
2012 5 21
2012 5 21

2013 4 22
2013 5 31
2013 6 10
2013 6 10

2014 4  7
2014 5 16
2014 5 26
2014 5 26

2015 3 30
2015 5  8
2015 5 18
2015 5 18

2016 4 18
2016 5 27
2016 6  6
2016 6  6

2017 4  3
2017 5 12
2017 5 22
2017 5 22

2018 3 26
2018 5  4
2018 5 14
2018 5 14

2019 4 15
2019 5 24
2019 6  3
2019 6  3

2020 4  6
2020 5 15
2020 5 25
2020 5 25

2100 4 18
2100 5 27
2100 6  6
2100 6  6

Gregorian Easters

Other entries on this page are showing gregorian easter results despite the nonsensical character of those results (for example, no country celebrated easter using the Gregorian calendar before 1583).

Nevertheless, here is an implementation which reproduces those numbers, based on the same resource I used for the Julian easters:

<lang j>ged=:3 :0

 ce =. <. y%100 
 GN =.  1 + 19 | y
 CY =.      30 | 23 + (<.4 %~ 3 * ce+1) - <. 25 %~ 13 + ce*8
 YR =.     400 | y
 SN =. 6 -   7 | 6 + YR + (<. YR%4) -  <. YR%100
 dm =. 21 + 30 | 3 + CY + 19*GN
 DM =. dm - 49 < dm+11 < GN
 dys=. 0 39 49 56 60 +/~ DM + 1 + 7 | 60+SN-DM
 y,"0 1(+/\0 0 0 31 30 31 30) (I.,"0]-<:@I.{[) dys

)</lang>

And here is the required example (and note that I am including the same Corpus Christi feast date here that others are using, because that makes sense with recent Gregorian dates even though it is a nonsense value for earlier dates):

<lang j> ged (400 + 100* i.17),(2010 + i.11),2100</lang> output (in each block of dates, they are, in order Easter, Ascension Thursday, Pentecost, Trinity Sunday, and Corpus Christi feast):

 400 4  2
 400 5 11
 400 5 21
 400 5 28
 400 6  1

 500 4  4
 500 5 13
 500 5 23
 500 5 30
 500 6  3

 600 4 13
 600 5 22
 600 6  1
 600 6  8
 600 6 12

 700 4 15
 700 5 24
 700 6  3
 700 6 10
 700 6 14

 800 4 23
 800 6  1
 800 6 11
 800 6 18
 800 6 22

 900 3 28
 900 5  6
 900 5 16
 900 5 23
 900 5 27

1000 3 30
1000 5  8
1000 5 18
1000 5 25
1000 5 29

1100 4  8
1100 5 17
1100 5 27
1100 6  3
1100 6  7

1200 4  9
1200 5 18
1200 5 28
1200 6  4
1200 6  8

1300 4 18
1300 5 27
1300 6  6
1300 6 13
1300 6 17

1400 4 20
1400 5 29
1400 6  8
1400 6 15
1400 6 19

1500 4  1
1500 5 10
1500 5 20
1500 5 27
1500 5 31

1600 4  2
1600 5 11
1600 5 21
1600 5 28
1600 6  1

1700 4 11
1700 5 20
1700 5 30
1700 6  6
1700 6 10

1800 4 13
1800 5 22
1800 6  1
1800 6  8
1800 6 12

1900 4 15
1900 5 24
1900 6  3
1900 6 10
1900 6 14

2000 4 23
2000 6  1
2000 6 11
2000 6 18
2000 6 22

2010 4  4
2010 5 13
2010 5 23
2010 5 30
2010 6  3

2011 4 24
2011 6  2
2011 6 12
2011 6 19
2011 6 23

2012 4  8
2012 5 17
2012 5 27
2012 6  3
2012 6  7

2013 3 31
2013 5  9
2013 5 19
2013 5 26
2013 5 30

2014 4 20
2014 5 29
2014 6  8
2014 6 15
2014 6 19

2015 4  5
2015 5 14
2015 5 24
2015 5 31
2015 6  4

2016 3 27
2016 5  5
2016 5 15
2016 5 22
2016 5 26

2017 4 16
2017 5 25
2017 6  4
2017 6 11
2017 6 15

2018 4  1
2018 5 10
2018 5 20
2018 5 27
2018 5 31

2019 4 21
2019 5 30
2019 6  9
2019 6 16
2019 6 20

2020 4 12
2020 5 21
2020 5 31
2020 6  7
2020 6 11

2100 3 28
2100 5  6
2100 5 16
2100 5 23
2100 5 27

Perl

Works with: Perl version 5.10


<lang perl>#!/usr/bin/perl

use strict; use warnings; use Date::Calc qw(:all);

my @abbr = qw( Not Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );

my %c_hols = (

	Easter=>     0,
	Ascension=> 39,
	Pentecost=> 49,
	Trinity=>   56,
	Corpus=>    60

);

sub easter { my $year=shift;

my $ay=$year % 19; my $by=int($year / 100); my $cy=$year % 100; my $dy=int($by/4); my $ey=$by % 4; my $fy=int(($by+8)/25); my $gy=int(($by-$fy+1)/3); my $hy=($ay*19+$by-$dy-$gy+15) % 30; my $iy=int($cy/4); my $ky=$cy % 4; my $ly=(32+2*$ey+2*$iy-$hy-$ky) % 7; my $m_y=int(($ay+11*$hy+22*$ly)/451);

my $month=int(($hy+$ly-7*$m_y+114)/31); my $day=(($hy+$ly-7*$m_y+114) % 31)+1;

return ($month, $day, $year); }

sub cholidays { my $year=shift; my ($emon, $eday)=easter($year); my @fields; printf("%4s: ", $year);

foreach my $hol (sort { $c_hols{$a}<=>$c_hols{$b} } keys %c_hols) { my ($ye,$mo,$da)=Add_Delta_Days($year,$emon,$eday,$c_hols{$hol}); my $month=$abbr[$mo]; push @fields, sprintf("%s: %02s %s",$hol,$da,$month); } print join (", ",@fields); print "\n"; }


print "Christian holidays, related to Easter, for each centennial from ", "400 to 2100 CE:\n"; for (my $year=400; $year<=2100; $year+=100) { cholidays($year); }

print "Christian holidays, related to Easter, ", "for years from 2010 to 2020 CE:\n";


cholidays($_) for(2010..2020); </lang>

Output:

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
 400: Easter: 02 Apr, Ascension: 11 May, Pentecost: 21 May, Trinity: 28 May, Corpus: 01 Jun
 500: Easter: 04 Apr, Ascension: 13 May, Pentecost: 23 May, Trinity: 30 May, Corpus: 03 Jun
 600: Easter: 13 Apr, Ascension: 22 May, Pentecost: 01 Jun, Trinity: 08 Jun, Corpus: 12 Jun
 700: Easter: 15 Apr, Ascension: 24 May, Pentecost: 03 Jun, Trinity: 10 Jun, Corpus: 14 Jun
 800: Easter: 23 Apr, Ascension: 01 Jun, Pentecost: 11 Jun, Trinity: 18 Jun, Corpus: 22 Jun
 900: Easter: 28 Mar, Ascension: 06 May, Pentecost: 16 May, Trinity: 23 May, Corpus: 27 May
1000: Easter: 30 Mar, Ascension: 08 May, Pentecost: 18 May, Trinity: 25 May, Corpus: 29 May
1100: Easter: 08 Apr, Ascension: 17 May, Pentecost: 27 May, Trinity: 03 Jun, Corpus: 07 Jun
1200: Easter: 09 Apr, Ascension: 18 May, Pentecost: 28 May, Trinity: 04 Jun, Corpus: 08 Jun
1300: Easter: 18 Apr, Ascension: 27 May, Pentecost: 06 Jun, Trinity: 13 Jun, Corpus: 17 Jun
1400: Easter: 20 Apr, Ascension: 29 May, Pentecost: 08 Jun, Trinity: 15 Jun, Corpus: 19 Jun
1500: Easter: 01 Apr, Ascension: 10 May, Pentecost: 20 May, Trinity: 27 May, Corpus: 31 May
1600: Easter: 02 Apr, Ascension: 11 May, Pentecost: 21 May, Trinity: 28 May, Corpus: 01 Jun
1700: Easter: 11 Apr, Ascension: 20 May, Pentecost: 30 May, Trinity: 06 Jun, Corpus: 10 Jun
1800: Easter: 13 Apr, Ascension: 22 May, Pentecost: 01 Jun, Trinity: 08 Jun, Corpus: 12 Jun
1900: Easter: 15 Apr, Ascension: 24 May, Pentecost: 03 Jun, Trinity: 10 Jun, Corpus: 14 Jun
2000: Easter: 23 Apr, Ascension: 01 Jun, Pentecost: 11 Jun, Trinity: 18 Jun, Corpus: 22 Jun
2100: Easter: 28 Mar, Ascension: 06 May, Pentecost: 16 May, Trinity: 23 May, Corpus: 27 May
Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010: Easter: 04 Apr, Ascension: 13 May, Pentecost: 23 May, Trinity: 30 May, Corpus: 03 Jun
2011: Easter: 24 Apr, Ascension: 02 Jun, Pentecost: 12 Jun, Trinity: 19 Jun, Corpus: 23 Jun
2012: Easter: 08 Apr, Ascension: 17 May, Pentecost: 27 May, Trinity: 03 Jun, Corpus: 07 Jun
2013: Easter: 31 Mar, Ascension: 09 May, Pentecost: 19 May, Trinity: 26 May, Corpus: 30 May
2014: Easter: 20 Apr, Ascension: 29 May, Pentecost: 08 Jun, Trinity: 15 Jun, Corpus: 19 Jun
2015: Easter: 05 Apr, Ascension: 14 May, Pentecost: 24 May, Trinity: 31 May, Corpus: 04 Jun
2016: Easter: 27 Mar, Ascension: 05 May, Pentecost: 15 May, Trinity: 22 May, Corpus: 26 May
2017: Easter: 16 Apr, Ascension: 25 May, Pentecost: 04 Jun, Trinity: 11 Jun, Corpus: 15 Jun
2018: Easter: 01 Apr, Ascension: 10 May, Pentecost: 20 May, Trinity: 27 May, Corpus: 31 May
2019: Easter: 21 Apr, Ascension: 30 May, Pentecost: 09 Jun, Trinity: 16 Jun, Corpus: 20 Jun
2020: Easter: 12 Apr, Ascension: 21 May, Pentecost: 31 May, Trinity: 07 Jun, Corpus: 11 Jun

PicoLisp

<lang PicoLisp>(load "@lib/cal.l") # For 'easter' function

(de dayMon (Dat)

  (let D (date Dat)
     (list (day Dat *Day) " " (align 2 (caddr D)) " " (get *Mon (cadr D))) ) )

(for Y (append (range 400 2100 100) (range 2010 2020))

  (let E (easter Y)
     (prinl
        (align 4 Y)
        " Easter: " (dayMon E)
        ", Ascension: " (dayMon (+ E 39))
        ", Pentecost: " (dayMon (+ E 49))
        ", Trinity: " (dayMon (+ E 56))
        ", Corpus: " (dayMon (+ E 60)) ) ) )</lang>

Output:

 400 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
 500 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
 600 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
 700 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
 800 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
 900 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May
1000 Easter: Sun 30 Mar, Ascension: Thu  8 May, Pentecost: Sun 18 May, Trinity: Sun 25 May, Corpus: Thu 29 May
1100 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
1200 Easter: Sun  9 Apr, Ascension: Thu 18 May, Pentecost: Sun 28 May, Trinity: Sun  4 Jun, Corpus: Thu  8 Jun
1300 Easter: Sun 18 Apr, Ascension: Thu 27 May, Pentecost: Sun  6 Jun, Trinity: Sun 13 Jun, Corpus: Thu 17 Jun
1400 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
1500 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
1600 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
1700 Easter: Sun 11 Apr, Ascension: Thu 20 May, Pentecost: Sun 30 May, Trinity: Sun  6 Jun, Corpus: Thu 10 Jun
1800 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
1900 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
2000 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
2100 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May
2010 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
2011 Easter: Sun 24 Apr, Ascension: Thu  2 Jun, Pentecost: Sun 12 Jun, Trinity: Sun 19 Jun, Corpus: Thu 23 Jun
2012 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
2013 Easter: Sun 31 Mar, Ascension: Thu  9 May, Pentecost: Sun 19 May, Trinity: Sun 26 May, Corpus: Thu 30 May
2014 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
2015 Easter: Sun  5 Apr, Ascension: Thu 14 May, Pentecost: Sun 24 May, Trinity: Sun 31 May, Corpus: Thu  4 Jun
2016 Easter: Sun 27 Mar, Ascension: Thu  5 May, Pentecost: Sun 15 May, Trinity: Sun 22 May, Corpus: Thu 26 May
2017 Easter: Sun 16 Apr, Ascension: Thu 25 May, Pentecost: Sun  4 Jun, Trinity: Sun 11 Jun, Corpus: Thu 15 Jun
2018 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
2019 Easter: Sun 21 Apr, Ascension: Thu 30 May, Pentecost: Sun  9 Jun, Trinity: Sun 16 Jun, Corpus: Thu 20 Jun
2020 Easter: Sun 12 Apr, Ascension: Thu 21 May, Pentecost: Sun 31 May, Trinity: Sun  7 Jun, Corpus: Thu 11 Jun

Python

Works with: Python version 2.6

Unfortunately, at present Python doesn't support date formatting for any dates before 1900. So while it is trivial to get the date for easter, it takes a bit more work to format the date.

<lang python>from dateutil.easter import * import datetime, calendar

class Holiday(object):

   def __init__(self, date, offset=0):
       self.holiday = date + datetime.timedelta(days=offset)
   def __str__(self):
       dayofweek = calendar.day_name[self.holiday.weekday()][0:3]
       month = calendar.month_name[self.holiday.month][0:3]
       return '{0} {1:2d} {2}'.format(dayofweek, self.holiday.day, month)

def get_holiday_values(year):

   holidays = {'year': year}
   easterDate = easter(year)
   holidays['easter'] = Holiday(easterDate) 
   holidays['ascension'] = Holiday(easterDate, 39)
   holidays['pentecost'] = Holiday(easterDate, 49)
   holidays['trinity'] = Holiday(easterDate, 56)
   holidays['corpus'] = Holiday(easterDate, 60)
   return holidays
   

def print_holidays(holidays):

   print '{year:4d} Easter: {easter}, Ascension: {ascension}, Pentecost: {pentecost}, Trinity: {trinity}, Corpus: {corpus}'.format(**holidays)
   

if __name__ == "__main__":

   print "Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:"
   for year in range(400, 2200, 100):
       print_holidays(get_holiday_values(year))
   print 
   print "Christian holidays, related to Easter, for years from 2010 to 2020 CE:"
   for year in range(2010, 2021):
       print_holidays(get_holiday_values(year))

</lang>

Output:

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
 400 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
 500 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
 600 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
 700 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
 800 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
 900 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May
1000 Easter: Sun 30 Mar, Ascension: Thu  8 May, Pentecost: Sun 18 May, Trinity: Sun 25 May, Corpus: Thu 29 May
1100 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
1200 Easter: Sun  9 Apr, Ascension: Thu 18 May, Pentecost: Sun 28 May, Trinity: Sun  4 Jun, Corpus: Thu  8 Jun
1300 Easter: Sun 18 Apr, Ascension: Thu 27 May, Pentecost: Sun  6 Jun, Trinity: Sun 13 Jun, Corpus: Thu 17 Jun
1400 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
1500 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
1600 Easter: Sun  2 Apr, Ascension: Thu 11 May, Pentecost: Sun 21 May, Trinity: Sun 28 May, Corpus: Thu  1 Jun
1700 Easter: Sun 11 Apr, Ascension: Thu 20 May, Pentecost: Sun 30 May, Trinity: Sun  6 Jun, Corpus: Thu 10 Jun
1800 Easter: Sun 13 Apr, Ascension: Thu 22 May, Pentecost: Sun  1 Jun, Trinity: Sun  8 Jun, Corpus: Thu 12 Jun
1900 Easter: Sun 15 Apr, Ascension: Thu 24 May, Pentecost: Sun  3 Jun, Trinity: Sun 10 Jun, Corpus: Thu 14 Jun
2000 Easter: Sun 23 Apr, Ascension: Thu  1 Jun, Pentecost: Sun 11 Jun, Trinity: Sun 18 Jun, Corpus: Thu 22 Jun
2100 Easter: Sun 28 Mar, Ascension: Thu  6 May, Pentecost: Sun 16 May, Trinity: Sun 23 May, Corpus: Thu 27 May

Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010 Easter: Sun  4 Apr, Ascension: Thu 13 May, Pentecost: Sun 23 May, Trinity: Sun 30 May, Corpus: Thu  3 Jun
2011 Easter: Sun 24 Apr, Ascension: Thu  2 Jun, Pentecost: Sun 12 Jun, Trinity: Sun 19 Jun, Corpus: Thu 23 Jun
2012 Easter: Sun  8 Apr, Ascension: Thu 17 May, Pentecost: Sun 27 May, Trinity: Sun  3 Jun, Corpus: Thu  7 Jun
2013 Easter: Sun 31 Mar, Ascension: Thu  9 May, Pentecost: Sun 19 May, Trinity: Sun 26 May, Corpus: Thu 30 May
2014 Easter: Sun 20 Apr, Ascension: Thu 29 May, Pentecost: Sun  8 Jun, Trinity: Sun 15 Jun, Corpus: Thu 19 Jun
2015 Easter: Sun  5 Apr, Ascension: Thu 14 May, Pentecost: Sun 24 May, Trinity: Sun 31 May, Corpus: Thu  4 Jun
2016 Easter: Sun 27 Mar, Ascension: Thu  5 May, Pentecost: Sun 15 May, Trinity: Sun 22 May, Corpus: Thu 26 May
2017 Easter: Sun 16 Apr, Ascension: Thu 25 May, Pentecost: Sun  4 Jun, Trinity: Sun 11 Jun, Corpus: Thu 15 Jun
2018 Easter: Sun  1 Apr, Ascension: Thu 10 May, Pentecost: Sun 20 May, Trinity: Sun 27 May, Corpus: Thu 31 May
2019 Easter: Sun 21 Apr, Ascension: Thu 30 May, Pentecost: Sun  9 Jun, Trinity: Sun 16 Jun, Corpus: Thu 20 Jun
2020 Easter: Sun 12 Apr, Ascension: Thu 21 May, Pentecost: Sun 31 May, Trinity: Sun  7 Jun, Corpus: Thu 11 Jun

Ruby

Works with: Ruby version 1.9

This code relies on Ruby 1.9 where hashes remember the insertion order of their keys.

<lang ruby>require 'date'

def easter_date(year)

 # Anonymous Gregorian algorithm
 # http://en.wikipedia.org/wiki/Computus#Algorithms 
 a = year % 19
 b = year / 100
 c = year % 100
 d = b / 4
 e = b % 4
 f = (b + 8) / 25
 g = (b - f + 1) / 3
 h = (19*a +b - d - g + 15) % 30
 i = c / 4
 k = c % 4
 l = (32 + 2*e + 2*i - h - k) % 7
 m = (a + 11*h + 22*l) / 451
 numerator = h + l - 7*m + 114
 month = numerator / 31
 day = (numerator % 31) + 1
 Date.new(year, month, day)

end

OFFSETS = {

 :easter => 0,
 :ascension => 39,
 :pentecost => 49,
 :trinity => 56,
 :corpus => 60,

}

def emit_dates(year)

 e = easter_date year
 dates = OFFSETS.collect {|(item, offset)| (e + offset).strftime("%e %b")}
 puts "%4s: %s" % [year, dates.join(', ')]

end

puts "year: " + OFFSETS.keys.join(', ') 400.step(2100, 100).each {|year| emit_dates year} puts "" (2010 .. 2020).each {|year| emit_dates year}</lang>

outputs

year: easter, ascension, pentecost, trinity, corpus
 400:  2 Apr, 11 May, 21 May, 28 May,  1 Jun
 500:  4 Apr, 13 May, 23 May, 30 May,  3 Jun
 600: 13 Apr, 22 May,  1 Jun,  8 Jun, 12 Jun
 700: 15 Apr, 24 May,  3 Jun, 10 Jun, 14 Jun
 800: 23 Apr,  1 Jun, 11 Jun, 18 Jun, 22 Jun
 900: 28 Mar,  6 May, 16 May, 23 May, 27 May
1000: 30 Mar,  8 May, 18 May, 25 May, 29 May
1100:  8 Apr, 17 May, 27 May,  3 Jun,  7 Jun
1200:  9 Apr, 18 May, 28 May,  4 Jun,  8 Jun
1300: 18 Apr, 27 May,  6 Jun, 13 Jun, 17 Jun
1400: 20 Apr, 29 May,  8 Jun, 15 Jun, 19 Jun
1500:  1 Apr, 10 May, 20 May, 27 May, 31 May
1600:  2 Apr, 11 May, 21 May, 28 May,  1 Jun
1700: 11 Apr, 20 May, 30 May,  6 Jun, 10 Jun
1800: 13 Apr, 22 May,  1 Jun,  8 Jun, 12 Jun
1900: 15 Apr, 24 May,  3 Jun, 10 Jun, 14 Jun
2000: 23 Apr,  1 Jun, 11 Jun, 18 Jun, 22 Jun
2100: 28 Mar,  6 May, 16 May, 23 May, 27 May

2010:  4 Apr, 13 May, 23 May, 30 May,  3 Jun
2011: 24 Apr,  2 Jun, 12 Jun, 19 Jun, 23 Jun
2012:  8 Apr, 17 May, 27 May,  3 Jun,  7 Jun
2013: 31 Mar,  9 May, 19 May, 26 May, 30 May
2014: 20 Apr, 29 May,  8 Jun, 15 Jun, 19 Jun
2015:  5 Apr, 14 May, 24 May, 31 May,  4 Jun
2016: 27 Mar,  5 May, 15 May, 22 May, 26 May
2017: 16 Apr, 25 May,  4 Jun, 11 Jun, 15 Jun
2018:  1 Apr, 10 May, 20 May, 27 May, 31 May
2019: 21 Apr, 30 May,  9 Jun, 16 Jun, 20 Jun
2020: 12 Apr, 21 May, 31 May,  7 Jun, 11 Jun

Tcl

<lang tcl>package require Tcl 8.5; # Advanced date handling engine

  1. Easter computation code from http://www.assa.org.au/edm.html

proc EasterDate year {

   set FirstDig [expr {$year / 100}]
   set Remain19 [expr {$year % 19}]
   # calculate Paschal Full Moon date
   set temp [expr {($FirstDig - 15)/2 + 202 - 11*$Remain19}]
   if {$FirstDig in {21 24 25 27 28 29 30 31 32 34 35 38}} {

incr temp -1

   } elseif {$FirstDig in {33 36 37 39 40}} {

incr temp -2

   }
   set temp [expr {$temp % 30}]
   set tA [expr {$temp + 21}]
   if {$temp == 29} {incr tA -1}
   if {$temp == 28 && $Remain19 > 10} {incr tA -1}
   # find the next Sunday
   set tB [expr {($tA - 19) % 7}]
   set tC [expr {(40 - $FirstDig) % 4}]
   if {$tC == 3} {incr tC}
   if {$tC > 1} {incr tC}
   set temp [expr {$year % 100}]
   set tD [expr {($temp + $temp/4) % 7}]
   set tE [expr {((20 - $tB - $tC - $tD) % 7) + 1}]
   set d [expr {$tA + $tE}]
   # return the date
   if {$d > 31} {

return [format "%02d April %04d" [expr {$d - 31}] $year]

   } else {

return [format "%02d March %04d" $d $year]

   }

}

  1. Use the Easter calculator to work out the data for the feasts

proc DateInfo year {

   set fields [format %4d: $year]\t
   set easter [clock scan [EasterDate $year] -format "%d %B %Y"]
   foreach {name delta} {

Easter 0 Ascension 39 Pentecost 49 Trinity 56 Corpus 60

   } {

set when [clock add $easter $delta days] append fields [clock format $when -format "${name}: %d %b, "]

   }
   return [string trimright $fields " ,"]

}

  1. Print the required info

puts "Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:" for {set year 400} {$year <= 2100} {incr year 100} {

   puts [DateInfo $year]

} puts "" puts "Christian holidays, related to Easter, for years from 2010 to 2020 CE:" for {set year 2010} {$year <= 2020} {incr year} {

   puts [DateInfo $year]

}</lang> Output:

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
 400:	Easter: 02 Apr,  Ascension: 11 May,  Pentecost: 21 May,  Trinity: 28 May,  Corpus: 01 Jun
 500:	Easter: 04 Apr,  Ascension: 13 May,  Pentecost: 23 May,  Trinity: 30 May,  Corpus: 03 Jun
 600:	Easter: 13 Apr,  Ascension: 22 May,  Pentecost: 01 Jun,  Trinity: 08 Jun,  Corpus: 12 Jun
 700:	Easter: 15 Apr,  Ascension: 24 May,  Pentecost: 03 Jun,  Trinity: 10 Jun,  Corpus: 14 Jun
 800:	Easter: 23 Apr,  Ascension: 01 Jun,  Pentecost: 11 Jun,  Trinity: 18 Jun,  Corpus: 22 Jun
 900:	Easter: 28 Mar,  Ascension: 06 May,  Pentecost: 16 May,  Trinity: 23 May,  Corpus: 27 May
1000:	Easter: 30 Mar,  Ascension: 08 May,  Pentecost: 18 May,  Trinity: 25 May,  Corpus: 29 May
1100:	Easter: 08 Apr,  Ascension: 17 May,  Pentecost: 27 May,  Trinity: 03 Jun,  Corpus: 07 Jun
1200:	Easter: 09 Apr,  Ascension: 18 May,  Pentecost: 28 May,  Trinity: 04 Jun,  Corpus: 08 Jun
1300:	Easter: 18 Apr,  Ascension: 27 May,  Pentecost: 06 Jun,  Trinity: 13 Jun,  Corpus: 17 Jun
1400:	Easter: 20 Apr,  Ascension: 29 May,  Pentecost: 08 Jun,  Trinity: 15 Jun,  Corpus: 19 Jun
1500:	Easter: 01 Apr,  Ascension: 10 May,  Pentecost: 20 May,  Trinity: 27 May,  Corpus: 31 May
1600:	Easter: 02 Apr,  Ascension: 11 May,  Pentecost: 21 May,  Trinity: 28 May,  Corpus: 01 Jun
1700:	Easter: 11 Apr,  Ascension: 20 May,  Pentecost: 30 May,  Trinity: 06 Jun,  Corpus: 10 Jun
1800:	Easter: 13 Apr,  Ascension: 22 May,  Pentecost: 01 Jun,  Trinity: 08 Jun,  Corpus: 12 Jun
1900:	Easter: 15 Apr,  Ascension: 24 May,  Pentecost: 03 Jun,  Trinity: 10 Jun,  Corpus: 14 Jun
2000:	Easter: 23 Apr,  Ascension: 01 Jun,  Pentecost: 11 Jun,  Trinity: 18 Jun,  Corpus: 22 Jun
2100:	Easter: 28 Mar,  Ascension: 06 May,  Pentecost: 16 May,  Trinity: 23 May,  Corpus: 27 May

Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010:	Easter: 04 Apr,  Ascension: 13 May,  Pentecost: 23 May,  Trinity: 30 May,  Corpus: 03 Jun
2011:	Easter: 24 Apr,  Ascension: 02 Jun,  Pentecost: 12 Jun,  Trinity: 19 Jun,  Corpus: 23 Jun
2012:	Easter: 08 Apr,  Ascension: 17 May,  Pentecost: 27 May,  Trinity: 03 Jun,  Corpus: 07 Jun
2013:	Easter: 31 Mar,  Ascension: 09 May,  Pentecost: 19 May,  Trinity: 26 May,  Corpus: 30 May
2014:	Easter: 20 Apr,  Ascension: 29 May,  Pentecost: 08 Jun,  Trinity: 15 Jun,  Corpus: 19 Jun
2015:	Easter: 05 Apr,  Ascension: 14 May,  Pentecost: 24 May,  Trinity: 31 May,  Corpus: 04 Jun
2016:	Easter: 27 Mar,  Ascension: 05 May,  Pentecost: 15 May,  Trinity: 22 May,  Corpus: 26 May
2017:	Easter: 16 Apr,  Ascension: 25 May,  Pentecost: 04 Jun,  Trinity: 11 Jun,  Corpus: 15 Jun
2018:	Easter: 01 Apr,  Ascension: 10 May,  Pentecost: 20 May,  Trinity: 27 May,  Corpus: 31 May
2019:	Easter: 21 Apr,  Ascension: 30 May,  Pentecost: 09 Jun,  Trinity: 16 Jun,  Corpus: 20 Jun
2020:	Easter: 12 Apr,  Ascension: 21 May,  Pentecost: 31 May,  Trinity: 07 Jun,  Corpus: 11 Jun