Calculating the date of Easter
source: M.R. Williams, 1977
Easter (the "Western Easter" and not the Easter of the Eastern Orthodox Churches) falls on the first Sunday following the last full moon that occurs on or after March 21. The following algorithm, due to Gauss, will calculate for a given year y (y >= 1583) a number representing the date of Easter as follows:
- If d <= 31 then Easter is on March d, and otherwise on April f, f = d - 31.
- The intermediate values C, G, g, c, and E occurring in the algorithm can briefly be described as follows:
- C is the century
- G is the "golden number", the number of the year in the "Metonic cycle" and is used to determine the position of the calendar moon
- g is the "Gregorian correction" and is the number of years such as 1700, 1800, 1900, etc., when a leap year was not held
- c is the "Clavian correction" for the Metonic cycle and amounts to about 8 days every 2500 years
- E is the "epact", the age of the moon on January 1 and thus may be used to find when the full moon occurs
-
Here's the algorithm:
- step 1: Let C = floor(y/100) + 1
- step 2: Let g = floor( 3C/4) - 12
- step 3: Let G = mod(y,19) + 1
- step 4: Let c = floor((8C + 5) / 25) - 5 - g
- step 5: Let e = floor(5y/4) - g - 10
- step 6: Let E = mod(11G + 20 + c, 30)
- step 7: If E <> 25, then go to step 9
- step 8: If G > 11, then let E = E + 1
- step 9: If E = 24, then let E = E + 1
- step 10: Let d = 44 - E
- step 11: If d < 21, then let d = d + 30
- step 12: Let d = d + 7 - mod(d + e, 7)
- step 13: stop
-
Write a program to determine the date of Easter for the years 1800, 1801, ..., 2000.
The program must be fully documented and follow appropriate style constraints. You must provide sufficient evidence that the program compiles and executes correctly.