Skip to content

Date of Easter in J

Vector 10:3, page 76

programming techniques mathematics and statistics

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 76

Dear Mr. Cannon,

At APL93 you asked me if I knew an algorithm for the date of Easter. Here is one I’ve carried with me for many years. If you transcribe it into APL you have to make the following ASCII-to-APL changes:

ASCII APL
NB. lamp
=. left arrow
<. floor
* times
_ overbar
+. or
*. and

If you want to use it in J, it needs no alterations. As you can see, J and APL are closely related.

The comments are ample, but could be elaborated even more. There is a great deal of astronomical and ecclesiastical history in these few lines. In the old Encyclopedia Brittanica article "Calendar" you can find some more interesting details. According to Donald Knuth, "There are many indications that the sole important application of arithmetic in the Middle Ages was the calculation of Easter date, and so such algorithms are historically significant." Here it is:

NB. z=. Easter y  (function header)
NB. y is the number of a Gregorian year.
NB. z is the month and day on which Easter Sunday falls in that year.
NB. For example, Easter 1989 is 3 26. Easter falls on the first
NB. Sunday following the first full moon which occurs on or after
NB. March 21. See Augustus DeMorgan, "A Budget of Paradoxes", and
NB. Donald Knuth, CACM 5, 4, April 1962, "The Calculation of Easter...",
NB. and his "Fundamental Algorithms", Section 1.3.2, problem 14.

NB. a is the Golden Number, the number of the year in the 19-year
NB. Metonic cycle, used to determine the position of the Moon. (The
NB. phases of the Moon have a cycle of approximately 19 years).

      a =. 1 + 19 | y

NB. c is the number of the century in which y falls. This algorithm
NB. accepts the year xx00 as occuring in the xx+1th century.

      c =. 1 + <. 0.01 * y

NB. g is the Gregorian correction, the number of preceding years
NB. like 1700, 1800, 1900 when leap year was not held.

      g =. _12 + <. 0.75 * c

NB. v is the Clavian correction, a correction of the Metonic cycle
NB. of about 8 days every 2500 years, used to synchronize Easter
NB. with the Moon's orbit.

      v =. _5 + <. 0.04 * 5 + 8 * c

NB. x is the extra days specifying when Sunday occurs in March.
NB. (March 7 - x will be a Sunday).

      x =. (_10 + <. 1.25 * y) - g

NB. p is the approximate age of the calendar moon at the beginning
NB. of the year.

      p =. 30 | 20 + v - g - 11 * a

NB. e is the epact, a better approximation than p.

      e =. p + (p = 24) +. (p = 25) *. a > 11

NB. t is the day of the full moon, calculated using s.

      s =. 44 - e
      t =. s + 30 * s < 21

NB. u is the day of the following Sunday, but may be greater than 31.

      u =. t + 7 - 7 | x + t

NB. d is the day of Easter Sunday.

      d =. u - 31 * u > 31

NB. m is the number of the month, 3 (March) if u was less than 32,
NB. and 4 (April) otherwise.

      m =. 3 + u > 31

NB. z is the month number and day of Easter in Gregorian year y.

      z =.  m , d

Yours truly,

Eugene McDonnell