This is G o o g l e's cache of http://home.earthlink.net/~neilbawd/easter.html.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:kXAIycnKR-sC:home.earthlink.net/~neilbawd/easter.html+&hl=en&ie=UTF-8


Google is not affiliated with the authors of this page nor responsible for its content.

Date of Easter According to Knuth

Date of Easter According to Knuth

2001-09-27

Get TEXT
 

Donald E. Knuth, The Art of Computer Programming, 1.3.2 Exercise 14-15.

[Commentary by Knuth, Forth by Wil Baden. This is not well-suited for Forth, but there's no advantage in purifying it.]

The following algorithm, due to the Neapolitan astronomer Aloysius Lilius and the German Jesuit mathematician Christopher Clavius in the late 16th century, is used by most Western churches to determine the date of Easter Sunday for any year after 1582.

Counters.

Y
Year.
G
Golden number.
C
Century.
X
Century leap year adjustment.
Z
Moon's orbit adjustment.
D
Sunday date.
E
Epact.
N
Day of month.
VARIABLE Y  \  Year
VARIABLE G  \  Golden number
VARIABLE C  \  Century
VARIABLE X  \  Century leap year adjustment
VARIABLE Z  \  Moon's orbit adjustment
VARIABLE D  \  Sunday date
VARIABLE E  \  Epact
VARIABLE N  \  Day of month

EASTER              ( yyyyy -- dd mm yyyyy )
Compute date of Easter for year yyyyy.
: EASTER            ( yyyyy -- dd mm yyyyy )

    Y !                      ( )

E1. Golden number.

G is the so-called "golden number" of the year in the 19-year Metonic cycle.

    Y @  19 MOD  1+  G !

E2. Century.

When Y is not a multiple of 100, C is the century number; for example, 1984 is in the twentieth century.

    Y @  100 /  1+  C !

E3. Corrections.

Here X is the number of years, such as 1900, in which leap year was dropped in order to keep in step with the sun; Z is a special correction designed to synchronize Easter with the moon's orbit.

    C @  3 4 */  12 -  X !
    C @  8 *  5 +  25 /  5 -  Z !

E4. Find Sunday.

March ((-D) mod 7) actually will be a Sunday.

    Y @  5 4 */  X @ -  10 -  D !

E5. Epact.

This number E is the epact, which specifies when a full moon occurs.

    G @  11 *  20 +  Z @ +  X @ -  30 MOD
        dup 0< IF  30 +  THEN
        E !
    E @  25 =  ANDIF  G @  11 >  THEN
    ORIF  E @ 24 =  THEN
        IF  1 E +!  THEN

E6. Find full moon.

Easter is supposedly the first Sunday following the first full moon that occurs on or after March 21. Actually perturbations in the moon's orbit do not make this strictly true, but we are concerned here with the "calendar moon" rather than the actual moon. The N'th of March is a calendar full moon.

    44  E @ -  N !
    N @  21 < IF  30 N +!  THEN

E7. Advance to Sunday.

    N @  7 +  
    D @  N @ +  7 MOD  -  
    N !

E8. Get month.

    N @  31 > IF
        N @  31 -  4  Y @
    ELSE
        N @  3  Y @
    THEN ;

.EASTER             ( yyyyy -- )
Display date of Easter for year yyyyy.
: .EASTER      ( yyyyy -- )
    EASTER  .  4 = IF  ." April"  ELSE  ." March"  THEN  3 .R ;

</PLAINTEXT>

Go back to home page.