I found this old QBasic program that calculates the date of Easter
Sunday in any year. Allegedly, it is 100% accurate. Actually, the
program contains two routines to do the calculation. They always come
up with the same answer, so I suppose they must be equivalent at some
level. However, I can't see how this is so.
dow
-------------------------------------------------------
' EASTER.BAS - Calculates date of Easter Sunday
' EaSun algorithm published in Scientific American magazine, March
' 2001, Page 82. Earlier published by Thomas H. O'Bierne in 1965.
' Algorithm includes all rules for calculating the date of Easter.
' Adapted into QBasic by David Williams. 2001. Modified 2005.
' ES2 algorithm posted on internet by Jim King, and included
' here for comparison. Although algorithms look different,
' they always produce same answer.
DECLARE SUB EaSun (Year%, Month%, Day%)
DECLARE SUB ES2 (Year%, Month%, Day%)
DEFINT A-Z
CLS
INPUT "Year"; Year
CALL EaSun(Year, Month, Day) ' change to ES2 for comparison
PRINT "Date of Easter Sunday in year"; Year
PRINT "Month number ="; Month
PRINT "Day number ="; Day
IF Month = 3 THEN ' 3rd month of year
N$ = "March"
ELSE ' must be 4th month
N$ = "April"
END IF
PRINT "So date is: "; N$; STR$(Day); ","; Year
END
SUB EaSun (Year, Month, Day)
' Returns date of Easter Sunday, in Gregorian Year "Year",
' as "Month" and "Day", both as numbers.
A = Year MOD 19
B = Year \ 100
C = Year MOD 100
D = B \ 4
E = B MOD 4
G = (8 * B + 13) \ 25
H = (19 * A + B - D - G + 15) MOD 30
M = (A + 11 * H) \ 319
J = C \ 4
K = C MOD 4
L = (2 * E + 2 * J - K - H + M + 32) MOD 7
Q = H - M + L
Month = (Q + 90) \ 25 ' month. 3 = March. 4 = April.
Day = (Q + Month + 19) MOD 32 ' day of month
END SUB
SUB ES2 (Year, Month, Day) ' algorithm posted by Jim King
A = Year MOD 19
B = Year \ 100
C = Year MOD 100
D = B \ 4
E = B MOD 4
F = (B + 8) \ 25
G = (B - F + 1) \ 3
H = (19 * A + B - D - G + 15) MOD 30
I = C \ 4
K = C MOD 4
L = (32 + 2 * E + 2 * I - H - K) MOD 7
M = (A + 11 * H + 22 * L) \ 451
N = H + L - 7 * M + 114
Month = N \ 31
Day = N MOD 31 + 1
END SUB
--------------------------------------------------------


|