Re: Easter day challenge Message #3 Posted by glynn on 7 Apr 2003, 11:03 p.m., in response to message #2 by hugh
Did you scope out the algorithm at:
http://aa.usno.navy.mil/faq/docs/easter.html
Quoting here:
Computing the Date of Easter:
The rule is that Easter is the first Sunday after the first ecclesiastical full moon that occurs on or after March 21. The lunar cycles used by the ecclesiastical system are simple to program. The following algorithm will compute the date of Easter in the Gregorian Calendar system.
Please note the following: This is an integer calculation. All variables are integers and all remainders from division are dropped.
The algorithm uses the year, y, to give the month, m, and day, d, of Easter. The symbol * means multiply.
c = y / 100
n = y - 19 * ( y / 19 )
k = ( c - 17 ) / 25
i = c - c / 4 - ( c - k ) / 3 + 19 * n + 15
i = i - 30 * ( i / 30 )
i = i - ( i / 28 ) * ( 1 - ( i / 28 ) * ( 29 / ( i + 1 ) )
* ( ( 21 - n ) / 11 ) )
j = y + y / 4 + i + 2 - c + c / 4
j = j - 7 * ( j / 7 )
l = i - j
m = 3 + ( l + 40 ) / 44
d = l + 28 - 31 * ( m / 4 )
For example, using the year 2010,
y=2010,
c=2010/100=20,
n=2010 - 19 x (2010/19) = 15,
etc. resulting in Easter on April 4, 2010.
The algorithm is due to J.-M. Oudin (1940) and is reprinted in the Explanatory Supplement to the Astronomical Almanac, ed. P. K. Seidelmann (1992). See Chapter 12, "Calendars", by L. E. Doggett.
|