From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 25-AUG-1993 12:59:22.90
To:	EVERHART
CC:	
Subj:	Re: LIB$DAY in DCL?

X-Newsgroups: comp.os.vms
Subject: Re: LIB$DAY in DCL?
Message-ID: <1993Aug24.184904.1@ualr.edu>
From: domiller@ualr.edu
Date: 24 Aug 93 18:49:04 CST
Organization: University of Arkansas at Little Rock
Nntp-Posting-Host: hydra.ualr.edu
Lines: 59
To: Info-VAX@KL.SRI.COM
X-Gateway-Source-Info: USENET

In article <267@mccoy.dbaccess.com>, steve@dbaccess.com (Steve Suttles) writes:
> Very good.  Now does anyone have the algorithm for computing the date of
> Easter (or better yet, the location of a collection of this stuff?  I'm
> often in need of it and have to reconstruct it cuz I never wrote it down
> when I had it...

Okay, you asked for it.  Following is some (marginal) FORTRAN code to calculate
Easter.  This was derived from the "Book of Common Prayer", which expresses it
in tabular/formula notation.  There may well be a better algorithm, but this
seems to work.
	Dale

	implicit none
c	Compute easter for any year from 1900-?
	integer calendar_year,leap,n,first_day,first_sunday
	integer paschal_count,paschal_offset,march_sunday2,passover_days
	integer num_weeks,easter_sunday
	integer*2 paschal(19)
c	A table of the dates for the Paschal full moon, taking March 1 as 1
	data paschal/45,34,23,42,31,49,39,28,47,36,25,44,
	1            33,22,41,30,48,38,27/

	do calendar_year = 1900,3000
	if(mod(calendar_year,400).eq.0 .or.
	1   ((mod(calendar_year,4).eq.0) .and.
	2   (mod(calendar_year,100).ne.0))) then
	    leap = 1
	else
	    leap = 0
	end if
	n=calendar_year-1760
	first_day=(((n-1)/4)+1)*5+n-(4*((n-1)/4)+1)-(n+59)/100+(n+159)/400
	first_day=first_day-7*((first_day-1)/7) 
	if (first_day.eq.1) then
	    first_sunday = 1
	else
	    first_sunday = 9 - first_day
	end if
c	calculate the golden number
	paschal_count = mod (calendar_year,19) + 1
	paschal_offset = paschal (paschal_count)
	march_sunday2 = first_sunday + 11 - leap
	passover_days = paschal (paschal_count) - march_sunday2
	num_weeks = passover_days / 7
	easter_sunday = march_sunday2 + (num_weeks * 7) + 7
	if(easter_sunday.gt.31) then
	    print*,calendar_year,' Easter is April',easter_sunday - 31
	    continue
	else
	    print*,calendar_year,' Easter is March',easter_sunday
	end if
	end do
	stop
	end

-- 
Dale O. Miller - domiller@ualr.edu   | University of Arkansas at Little Rock
Systems Programmer                   | 2801 S. University Ave.
Voice: +1 501 569 8714               | Little Rock, AR  72204-1099  USA

