Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Easter finder

 Keywords:  

;Easter finder
;From Scientific American  March 2001
;Easter is a Quasicrystal by Ian Stewart
;Algorithm by Thomas H. O'Beirne of Glasgow
;as originally published in Puzzles and Paradoxes
;(Oxford University Press 1965)

#DefineFunction FindEaster(x)
    X=INT(X)

;1  ;Divide X by 19 to get a quotient (which we ignore) and
    ;a reminader A (This is the year's position in the 19 year
    ;lunar cycle.  (A+1) is the Golden number)
    A=X MOD 19

;2  ;Divide X by 100 to get a quotient B and remainder C
    B=X / 100
    C=X MOD 100

;3  ;Divide B by 4 to get quotient D and remainder E
    D=B/4
    E=B MOD 4

;4  ;Divide (8B+13) by 25 to get quotient G.  Ignore remainder.
     G = ((8*B)+13) / 25

;5  ;Divide 19A+B-D-G+15 by 30 to get a quotient (which we ignore)
    ;and a remainder H (The year's EPACT is 23-H when H is less than 24
    ;and 53-H otherwise)
    H = ((19*A)+B-D-G+15) MOD 30

;6  ;Divide A+11H by 319 to get quotient M and a ignored remainder
    M = (A + (11*H)) / 319

;7  ;Divide C by 4 to get quotient J and remainder K
    J= C/4
    K= C MOD 4

;8  ;Divide 2E+2J-K-H-M+32 by 7 to get a quotient (which we ignore)
    ;and a remainder L
    L = ((2*E)+(2*J)-K-H-M+32) MOD 7

;9  ;Divide H-M+L+90 by 25 to get quotient N and a ignored remainder
    N = (H-M+L+90) / 25

;10 ;Divide H-M+L+N+19 by 32 to get a quotient (which we ignore) and
    ; a remainder P
    P = (H-M+L+N+19) MOD 32

;Easter Sunday is the Pth day ofthe Nth month 
;(N can be 3=March or 4=April)
    Z=strcat(X,":",strfixleft(N,"0",2),":",strfixleft(P,":",2),":00:00:00")
    return(Z)
   
#endfunction


list=""

for xx=1972 to 2100
   easter=FindEaster(xx)
   if easter=="%xx%:04:19:00:00:00"
      if list=="" then list=xx
      else list=strcat(list,@tab,xx)
   endif
next

AskItemList("Deana's Easter Birthdays",list,@tab,@unsorted,@single)

Article ID:   W14602
Filename:   Easter finder.txt