 The Museum of HP Calculators

HP Forum Archive 11

 Easter day challengeMessage #1 Posted by hugh on 3 Apr 2003, 7:45 p.m. it will soon be easter. this year, easter sunday is on April 20. the idea is to write an easter sunday calculation program valid for years 1900-2099 on the 25C (ie in 50 steps or less!). to make it more interesting, i've already had a go, but my answer is incomplete. completely different approaches are allowed as long as they work! i've managed to simplify a formula down to the following logic: d =(204 - 11*(y%19))%30; if (d < 28) ++d; return d+27-(5*y/4+d)%7; where `y' is the input year. the result `d' is the day number from march, where d > 31 implies april (d-31). after some struggle, i write: sto0 1 9 / int 1 9 * rcl0 - 1 1 * 2 0 4 + sto1 3 0 / int 3 0 * sto-1 2 8 sto2 rcl1 x>=y? gto35 1 + rcl0 5 * 4 / int sto-2 + 7 / int 7 * rcl2 + which works but always returns the answer + 1 :-) be sure to test 1954 (which is April 18). happy easter!

 Re: Easter day challengeMessage #2 Posted by hugh on 7 Apr 2003, 5:33 p.m.,in response to message #1 by hugh i finally done this in 46 steps. wow, 3 steps to party! but the program's about as vicious as a cornered rat.

 Re: Easter day challengeMessage #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.

 Re: Easter day challengeMessage #4 Posted by hugh on 8 Apr 2003, 1:13 p.m.,in response to message #3 by glynn hi glynn, i had seen the oudin version. but it is way to large for 50 steps. instead i found a formular by Carter valid only for 1900-2099 then simplified it a bit more and tied that. Go back to the main exhibit hall