' Easter date Calculation -- function definition by HarmonV, February 2007 print "The date of Easter for any year from 1583 to 4099." print "" [begin] input "Enter year: "; yyyy yyyy=abs(int(yyyy)) if yyyy=0 then [finish] Easter$ = Easter$(yyyy) if Easter$<>"" then print Easter$ else print "Invalid year" end if goto [begin] [finish] print "Done." end function Easter$(yyyy) if yyyy<1583 or yyyy>4099 then Easter$="": exit function gn = yyyy mod 19 + 1 ' Golden Number c = int(yyyy/100)+1 ' Century JE = (11*(gn-1)) mod 30 ' Julian Epact # S = int(3*c/4) ' Solar Equation (3 non-leap days every 4 centuries) L = int((8*c+5)/25) ' Lunar Equation (8 days every 25 centuries) GE = JE - S + L + 8 ' Gregorian Epact # if GE<1 then GE = GE + 30*(1+int(abs(GE)/30)) GE = GE mod 30 ' efm = Ecclesiastical full moon (22=Mar 22nd, 32=Apr 1st, etc) if GE<24 then efm = 44-GE if GE>23 then efm = 74-GE if (GE=24) or (GE=25 and gn>11) then efm = efm - 1 wd = (efm + 2 + yyyy + int(yyyy/4) - int(yyyy/100) + int(yyyy/400) ) mod 7 ed = efm + 7 - wd ' Easter Day = first Sunday after EFM mm = 3+int(ed/32): mm$=str$(mm): if len(mm$)=1 then mm$="0"+mm$ dd = ed - 31*int(mm/4): dd$=str$(dd): if len(dd$)=1 then dd$="0"+dd$ Easter$ = str$(yyyy)+mm$+dd$ end function
|