Easter calculation
Author Message
Easter calculation

Since this is the Easter holiday weekend, I thought some of you might be
interested in how the date of Easter is calculated.

Easter Computation:

The following algorithm comes from volume one of 'The Art of Computer
Programming', by Donald Knuth, Second Edition, pages 155-156.

Let y be the year for which the date of Easter is desired.

g = (y mod 19) + 1               (g is the so-called "golden number" of
the year in the 19-year Metonic cycle.)

c = int(y / 100) + 1             (c is the century number.)

x = int(3 * c / 4) - 12          (x is the number of years, such as 1900,
in which leap year was dropped to keep
in step with the sun.)

z = int((8 * c + 5) / 25) - 5    (z is a special correction designed
to synchronize Easter with the
moon's orbit.)

d = int(5 * y / 4) - x - 10      (d is a factor to adjust the date to
the following Sunday.)

e = abs(11 * g + 20 + z - x) mod 30
if (e = 25 and g > 11)           (e is the so-called "epact" which
or                            specifies when a full moon occurs.)
(e = 24)
e = e + 1
(Easter is supposedly the "first Sunday following
n = 44 - e              the first full moon which occurs on or after March
if (n < 21)             21."  Actually perturbations  in the moon's orbit
n = n + 30          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.)

n = n + 7 - ((d + n) mod 7)      (Advance to following Sunday.)

if (n > 31)                      (If n > 31 then Easter falls in the
month = 4                     month of April instead of March.)
day = n - 31
else
month = 3
day = n

Where:  int = integer part (e.g.: int(3.5) = 3)
mod = modulus or remainder part (e.g.: (10 mod 7) = 3)
abs = absolute value (e.g.: abs(3) = 3, abs(-3) = 3)

Note that this algorithm is only valid for the Gregorian Calendar.  In other
words, years 1583 forward.  All variables are integers.  If you calculate
Easter for years far into the future, some of the variables may overflow 16
bit integers.
--
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the

(please remove numbers from email id to respond)

Wed, 27 Sep 2000 03:00:00 GMT
Easter calculation

Quote:

> c = int(y / 100) + 1             (c is the century number.)

According to this, 2000 will be in the 21st century.  Please post only
Y2K compliant code.

--
I  |\   Randall Bart

v  | \  Cancer victim/Medical {*filter*} activist Todd McCormick jailed
e    |\ for using Marinol w/ prescription: http://www.*-*-*.com/ {*filter*}.org
Y    |/        http://{*filter*}magazine.com/toc/articles/toddheld.html
o    |\ Panic in the Year Zero Zero:   http://www.*-*-*.com/ ;
u    |/ Is it easy yet?: http://www.*-*-*.com/

Thu, 28 Sep 2000 03:00:00 GMT
Easter calculation

Quote:

> > c = int(y / 100) + 1             (c is the century number.)

>According to this, 2000 will be in the 21st century.  Please post only
>Y2K compliant code.

Take that up with Knuth.  Here is what Knuth says about the algorithm:

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.

Assuming Knuth hasn't made an error, and I haven't made an error in copying
the algorithm, whatever that algorithm comes up with WILL be the date of
Easter Sunday in year 2000.  The algorithm has already survived 400 years,
including a previous 400 year leap year in 1600.  It's pretty well debugged
by now, don't you think? ;-)
--
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the

(please remove numbers from email id to respond)

Fri, 29 Sep 2000 03:00:00 GMT
Easter calculation

Yes, the algorithm works, but the implication that 2000 is in the 21st
century is still wrong.  Under the Gregorian calendar, there is no year
0.  1 AD is the first year of the first century, 100 the last year of
the first century. December 31, 1 BC is followed by January 1, 1 AD.  Of
course, these dates were mapped retroactively onto the passage of time
as the calendar was not developed until long after the birth of Christ.
There is also a fairly sizable amount of data which suggests that there
was a error in calculations and that Jesus was actually born in what we
now call 4 BC.  If so, the new millenium actually began January 1,
1997!  So much for those pseudo-seers who say that there is something

Sat, 30 Sep 2000 03:00:00 GMT
Easter calculation

as the calendar was not developed until long after the birth of Christ.

Quote:
> There is also a fairly sizable amount of data which suggests that there
> was a error in calculations and that Jesus was actually born in what we
> now call 4 BC.  If so, the new millenium actually began January 1,
> 1997!  So much for those pseudo-seers who say that there is something
> special about the year 2000.

Oh, there's something special about the year 2000.  Ever wonder why we
call 1998, 1998 and not THE YEAR 1998.  Why not just call it 2000, why
is it always THE YEAR 2000.  Like it could be a month?  <G>.  Seriously
though, the impending computer system meltdown does make THE YEAR 2000
something very special indeed.

Sat, 30 Sep 2000 03:00:00 GMT
Easter calculation

Quote:

> Since this is the Easter holiday weekend, I thought some of you might be
> interested in how the date of Easter is calculated.

-snip-)

> Note that this algorithm is only valid for the Gregorian Calendar.  In other
> words, years 1583 forward.  All variables are integers.  If you calculate
> Easter for years far into the future, some of the variables may overflow 16
> bit integers.
> --
> Judson McClendon          This is a faithful saying and worthy of all
> Sun Valley Systems        acceptance, that Christ Jesus came into the

> (please remove numbers from email id to respond)

Hi:

For those who want to know why we can't go earlier than 1583, I submit
the following, written by a friend of mine, for your review and
consideration.

Prior to 1583, the day of the week cannot be calculated (it can-- but
the algorithm is very complex). In order to understand why we can't
calculate the week day, we need to look at the calendar history. Prior
to Julius ruling Rome (BC 46) the Roman year was 354 days. When Julius
came to power, one of his first challenge was to appease the farmers who
complained big time because according to their calendar it is spring
time and time to sow/plant but actually it was mid winter. Julius hired
Sosigenes (a mathematician) to figure out what went wrong. A tub of wine
and a couple of girls later, Sosigenes suggested that the length of the
year is wrong. It should have been 365.25 days. The extra .25 day after
four years became the extra day added in February. Julius made a mess of
46 BC by adding a couple of months (he made money on taxes --BIG time)
resulting that 46 BC had 445 days! Of course, Sosigenes, not having a
calculator, didn't realize that a solar year is realy 365.2428935 (his
calculation was too much by 10 minutes and some seconds in a year --not
bad for manual computation!). This error after 1600 years, adds up to
about 11 days. This is detected by astronomers who noticed that the
vernal equinox (when light and dark periods are equal in length)
occuring on March 21 was becoming earlier and earlier and in 1582 it was
on March 10. Christopher Clarius, an astronomer, went to Pope Gregory
XIII and addressed the concern. After seeing all the calculations for 7
months, pope Gregory knocked off 11 days on October 4 1582. The next
day, he decreed to be October 15 (so October 5-14 in the year 1582
didn't exist), but to not upset the Jews with their sabath, the day of
the week was NOT changed. To avoid this error again after 1500 years,
Pope Gregory, decreed that every 4 years a day will be added. However,
on a turn of the century, it will only be added if it's divisible by
400. Hence, although year 2000 will be a leap year, year 1900 was not.
SO the proper leap year test is:

(The following is in FutureBASIC)

' Leap year is if the year is evenly divisible by 4 and is not
' the turn of the century. If it is it must be evenly
' divisible by 400

isLeap=(yy MOD 4=0 AND yy MOD 100<>0) OR (yy MOD 400=0)

'===========================================================
' dayofweek - Calculate day of the week index
' At entry dd=date, mm=month, yy=year in format nnnn e.g. 1991
'                      this date should first be validated
' At exit z=index to day of the week (1=Sunday, 7=Saturday)
' routine valid for dates 1-1-1583 through 12-31-9999
'===========================================================
LOCAL FN DayOfWeek(mm,dd,yy)
t!=1/mm
k1=0.6+t! : l1=yy-k1
t!=12*k1
o1!=mm+t! : p1#=l1/100
z1=INT(p1#/4) : z2=INT(p1#) : z3=INT((5*l1)/4)
z4=INT(13*(o1!+1)/5) : z=z4+z3-z2+z1+dd
z=z-(7*INT(z/7))
END FN=z

So, I hope you all appreciate the complexity of computing dates.

:-)

tedd

PS: If is a fact that the year 2000 belongs in the 20th century (i.e,
1901-2000). The next century starts at the beginning of the year 2001.
So, the BIG event (i.e., the passage of 2000 years) will be on December
31, 11:59:59PM on the year 2000. However, considering that there is
considerable question as to when Christ was born and considering the
mistakes made in our calendar over the past 2000 years, then I would
give the accuracy of our present calendar plus or minus of at least 5
years. So, the big event could have already taken place and we won't
know for sure if it has passed until the year 2006.

--
____________________________________________________________________
____
|[  ]| mac programmer                            tedd f. sperling
|[__]|                                       http://sperling.com/

---

Sat, 30 Sep 2000 03:00:00 GMT
Easter calculation

Actually I will be staying home that night, snug in my paid off house,
with food, water, and clothing enough to last a couple of years.   And
with friendly neighbors of similar minds so we can be in a leadership
position as the chaos unfolds.

Charles Hall

Sun, 01 Oct 2000 03:00:00 GMT
Easter calculation

Quote:
>Prior to 1583, the day of the week cannot be calculated (it can-- but
>the algorithm is very complex). In order to understand why we can't

.
.
.

Quote:
>XIII and addressed the concern. After seeing all the calculations for 7
>months, pope Gregory knocked off 11 days on October 4 1582. The next
>day, he decreed to be October 15 (so October 5-14 in the year 1582
>didn't exist), but to not upset the Jews with their sabath, the day of

Thanks to you and your friend for an excellent post! I'd just like to add
that the above extract actually understates the "uglyness" in computing day
of the week/dates for times "around" the calendar change. In point of fact
the change to what we call the "Gregorian calendar" did not occur
everywhere at the same time. Many areas under the control/influence of the
Pope did change over in 1582 but many other areas did not. According to
"Calendrical Calculations" (Nachum Dershowitz & Edward M Reingold) the
protestant states of Europe did not follow immediately. Implementations
occured at various times and using various strategies with Great Britain
and her colonies including the US waiting till 1752, Russia didn't change
until 1918 and Turkey changed only in 1927.

Sun, 01 Oct 2000 03:00:00 GMT
Easter calculation

Quote:

> > > c = int(y / 100) + 1             (c is the century number.)

> >According to this, 2000 will be in the 21st century.  Please post only
> >Y2K compliant code.

> Take that up with Knuth.  Here is what Knuth says about the algorithm:

It doesn't matter what Knuth says; it doesn't matter what Lillius says;
it doesn't matter what Clavius says; "int(y / 100) + 1" is not century
number, and that alleged calculation of century number breaks on The
Day.  Even if the code works at least the comment has a bug.  Please
post only Y2K compliant code.

--
I  |\   Randall Bart

v  | \      Todd McCormick released after 12 day illegal incarceration
e    |\ for using Marinol w/ prescription: http://www.*-*-*.com/ {*filter*}.org
Y    |/     http://www.{*filter*}magazine.com/toc/articles/toddfree.htm
o    |\ Panic in the Year Zero Zero:   http://www.*-*-*.com/ ;
u    |/ Is it easy yet?: http://www.*-*-*.com/

Sun, 01 Oct 2000 03:00:00 GMT
Easter calculation

Quote:

>> > > c = int(y / 100) + 1             (c is the century number.)

>> >According to this, 2000 will be in the 21st century.  Please post only
>> >Y2K compliant code.

>> Take that up with Knuth.  Here is what Knuth says about the algorithm:

>It doesn't matter what Knuth says; it doesn't matter what Lillius says;
>it doesn't matter what Clavius says; "int(y / 100) + 1" is not century
>number, and that alleged calculation of century number breaks on The
>Day.  Even if the code works at least the comment has a bug.  Please
>post only Y2K compliant code.

And it doesn't matter what you say.  In the year 2000 you will see the
date produced by that algorithm (April 23) marked on calendars as 'Easter
Sunday'.  What is there to 'break'?  Live with it. :-)

In Knuth's algorithm, he simply put '[Century]', which I expanded.  These
kinds of algorithms contain lots of adjustment factors, and I'm sure that
'century' was not meant in the strict sense you suggest, but simply as a
brief description of the number being calculated at that point.  If it
makes you feel better, change the comment.  Either way, you'll still see
April 23 marked as Easter on calendars for year 2000. ;-)
--
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the

(please remove numbers from email id to respond)

Mon, 02 Oct 2000 03:00:00 GMT
Easter calculation

:>Calendars were invented by humans and not a law laid down by the gods. We
:>decide for ourselves what millenia are and when they begin or end. The only
:>rule is consensus.

Except for us Jews, for whom G-d specified the calendar.

Of course, the next millennium for us would be in 241 years or so.

[ snipped ]

--

Director, Dissen Software, Bar & Grill - Israel

Mon, 02 Oct 2000 03:00:00 GMT
Easter calculation

Okay, now re-write it in COBOL!

Mon, 02 Oct 2000 03:00:00 GMT
Easter calculation

Quote:
>Hi:

>For those who want to know why we can't go earlier than 1583, I submit
>the following, written by a friend of mine, for your review and
>consideration.

>Prior to 1583, the day of the week cannot be calculated (it can-- but
>the algorithm is very complex). In order to understand why we can't
>calculate the week day, we need to look at the calendar history. Prior
>to Julius ruling Rome (BC 46) the Roman year was 354 days. When Julius
>came to power, one of his first challenge was to appease the farmers who
>complained big time because according to their calendar it is spring
>time and time to sow/plant but actually it was mid winter. Julius hired
>Sosigenes (a mathematician) to figure out what went wrong. A tub of wine
>and a couple of girls later, Sosigenes suggested that the length of the
>year is wrong. It should have been 365.25 days. The extra .25 day after
>four years became the extra day added in February. Julius made a mess of
>46 BC by adding a couple of months (he made money on taxes --BIG time)
>resulting that 46 BC had 445 days! Of course, Sosigenes, not having a
>calculator, didn't realize that a solar year is realy 365.2428935 (his
>calculation was too much by 10 minutes and some seconds in a year --not
>bad for manual computation!). This error after 1600 years, adds up to
>about 11 days. This is detected by astronomers who noticed that the
>vernal equinox (when light and dark periods are equal in length)
>occuring on March 21 was becoming earlier and earlier and in 1582 it was
>on March 10. Christopher Clarius, an astronomer, went to Pope Gregory
>XIII and addressed the concern. After seeing all the calculations for 7
>months, pope Gregory knocked off 11 days on October 4 1582. The next
>day, he decreed to be October 15 (so October 5-14 in the year 1582
>didn't exist), but to not upset the Jews with their sabath, the day of
>the week was NOT changed. To avoid this error again after 1500 years,
>Pope Gregory, decreed that every 4 years a day will be added. However,
>on a turn of the century, it will only be added if it's divisible by
>400. Hence, although year 2000 will be a leap year, year 1900 was not.
>SO the proper leap year test is:

>(The following is in FutureBASIC)

>' Leap year is if the year is evenly divisible by 4 and is not
>' the turn of the century. If it is it must be evenly
>' divisible by 400

>isLeap=(yy MOD 4=0 AND yy MOD 100<>0) OR (yy MOD 400=0)

>'===========================================================
>' dayofweek - Calculate day of the week index
>' At entry dd=date, mm=month, yy=year in format nnnn e.g. 1991
>'                      this date should first be validated
>' At exit z=index to day of the week (1=Sunday, 7=Saturday)
>' routine valid for dates 1-1-1583 through 12-31-9999
>'===========================================================
>LOCAL FN DayOfWeek(mm,dd,yy)
>  t!=1/mm
>  k1=0.6+t! : l1=yy-k1
>  t!=12*k1
>  o1!=mm+t! : p1#=l1/100
>  z1=INT(p1#/4) : z2=INT(p1#) : z3=INT((5*l1)/4)
>  z4=INT(13*(o1!+1)/5) : z=z4+z3-z2+z1+dd
>  z=z-(7*INT(z/7))
>END FN=z

>So, I hope you all appreciate the complexity of computing dates.

>:-)

>tedd

>PS: If is a fact that the year 2000 belongs in the 20th century (i.e,
>1901-2000). The next century starts at the beginning of the year 2001.
>So, the BIG event (i.e., the passage of 2000 years) will be on December
>31, 11:59:59PM on the year 2000. However, considering that there is
>considerable question as to when Christ was born and considering the
>mistakes made in our calendar over the past 2000 years, then I would
>give the accuracy of our present calendar plus or minus of at least 5
>years. So, the big event could have already taken place and we won't
>know for sure if it has passed until the year 2006.

Thanx man, I did not know why or did not really want to know but this is
quick a like pritt story to read to the family and make them think I am
perfect, once again <GGGGG>
--
Andrew Calderbank

Wed, 04 Oct 2000 03:00:00 GMT

 Page 1 of 2 [ 24 post ] Go to page: [1] [2]

Relevant Pages