          A Simple Algorithm for a Perpetual Hebrew Calendar
                        Based on a Formula by Gauss

                              Dan Censor
             Department of Electrical and Computer Engineering
                    Ben Gurion University of the Negev
                        Beer Sheva, 84105, Israel

ABSTRACT

     The Hebrew calendar is a lunisolar calendar whose structure is dictated
by rather complicated rules involving astronomical phenomena and
ecclesiastical considerations. In addition to enthusiasts, a perpetual Hebrew
(or Jewish) calendar might be of interest to historical astronomers.
Nowadays this calendar has a more practical use because it also sets the
religious and national holidays in the state of Israel, and some of the
holidays are recognized by various institutions (e.g., universities and other
employers) in the US and elsewhere. The construction of a perpetual calendar
is facilitated by application of an astonishingly simple formula devised by
Gauss, which yields the Julian calendar date of the first day of the Passover
holiday (15th of the month of Nisan) for a given year. Repeated application of
the formula for two consecutive years yields the length of the corresponding
Hebrew calendar year, a datum containing all the necessary information needed
to construct the Hebrew calendar for that year.
	The procedure described here can be implemented in less than 1KB source
program on a personal computer or handheld programmable calculator.


INTRODUCTION

     The Explanatory Supplement[1] devotes a cursory section to the Hebrew, or
Jewish calendar, but rather than delving into its structure, dismisses it as
dictated by complex rules and refers the reader to the specialized literature.
See also an article about calendars in the Encyclopaedia Britannica[2]. While
algorithms for a perpetual Gregorian calendar are abundant (to the point where
they appear even in USA telephone books, for example), a comparably simple
algorithm for a perpetual Hebrew calendar, one which might be handled with a
handheld calculator, appears to be needed yet. The goal of the subsequently
given formalism is to close this gap and indeed describe such a perpetual
calendar. By providing a mathematically simple algorithm the interested reader
may use the perpetual calendar without a need to understand the historical,
ecclesiastical and astronomical details. From there one can go further and,
possessing a working algorithm, study the traditional principles and their
implementation.
     The present algorithm makes use of a simple formula given in a
comprehensive article in the Encyclopaedia Hebraica[3] and attributed to
Gauss. The references cited therein are given here for completeness[4-7].
Very helpful was also the work of Keren (Z.Z. Keren, "Calendars", unpublished, 
in Hebrew). The formula is displayed  and an example is given in the next 
section. The Gauss formula yields the Julian calendar date for the first day 
of the Jewish Passover (15 of the month of Nisan). A simple correction yields 
the corresponding Gregorian calendar date for this event. By application of
the formula to two consecutive years, the length of the Hebrew calendar year 
is obtained, and this number contains all the needed information for the
construction of the calendar for that year.
     The format used for explaining the algorithm is similar to that used by
Duffett-Smith[8], which is very convenient for step by step work with a
calculator, or for programming. Although the present notation is somewhat
slanted towards the BASIC language, no attempt is made to actually write out
a program code. The author successfully programmed the perpetual calendar on
the CASIO PB-1000 handheld personal computer.


COMPUTATION OF THE PASSOVER DATE

     You have to perform a few simple calculations on the year number and
substitute into the given formula. A few conditional statement, originating
from the Jewish ecclesiastical calendar, might defer the date by a day or two.
The date and week day of the Passover first day (15th of Nisan for that year)
follow.
     Here is how you do it:

Table 1:
________________________________________________________________________

Method and comments                                    Example
________________________________________________________________________

1. Set y=year. Year y=0 is excluded.                   y=1992
     If y is BCE then y'=-y+1, otherwise y'=y          y'=1992
2. Add 3760, Y=y'+3760, to get Creation year           Y=5752
3. Find a=12*Y+17                                      a=69041
4. Find A, the remainder of a divided by 19            A=a-INT(a/19)*19=14
5. Find B, the remainder of Y divided by 4             B=Y-INT(Y/4)*4=0
6. Use the Gauss formula
     F=32.0441+1.55424*A+0.25*B-0.00317779*Y           F=35.5248
     Find M, integer part of F                         M=INT(F)=35
     Find m=F-M, the fractional part of F              m=0.5248
7.  Find c=M+3*Y+5*B+5                                 c=17296
     Find C, the remainder of c divided by 7           C=c-INT(c/7)*7=6
8.  If C= 2 or 4 or 6 then M'=M+ 1,                    M'=M+1=35+1=36
     C'=C+1                                            C'=6+1=7
    If C=1, and A>6 and m>=0.6329, then
     M'=M+2, C'=C+2
    If C=0 and A>11 and m>=0.8977, then
     M'=M+1, C'=C+1
    Otherwise if none of the above applies, then
     M'=M, C'=C                                        M'=36, C'=7
11. Find the remainder of C' divided by 7.             C'=C'-INT(C'/7)*7=0
       If C'=0 then C'=7.                              C'=7		
     This is the day of the week (Sunday=1, etc.)      Saturday
9.  Add D, the difference in days between the
     Gregorian and Julian calendars for year y:         
     For dates after October 14, 1582, D=10, plus 1
     for every century year (1700, 1800, etc.) which
     is not a multiple of 400 (e.g., 1600, 2000)       D=13
10. Find M"=M'+D, this is the day on March or M"-31    M"=36+13-31=18
     is the day on April, in year y, when the first day of
     Passover takes place, i.e., 15 of Nisan, year Y.  April 18, 1992
________________________________________________________________________

     Final answer: The first day of the Passover, 15 of Nisan of the year 5752
by the Hebrew calendar occurs on Saturday, April 18, 1992 by the Gregorian
calendar.
    	Additional checkpoints: Your calculations should yield the following
dates and days of the week for the 15 of Nisan for the year y.

y=3760BCE, Thursday, April 17.
y=1BCE, Thursday, April 8.
y=1CE, Tuesday, March 29.
y=2000CE, Thursday April 20.
	In case you wish to compute for negative Y years, although years before
the Creation are meaningless in terms of Jewish tradition where Y=1 is the
first year, note that A above should be consistent with the following list on
a 19 years cycle:

Table 2:
________________________________________________________________________

year of cycle: 1  2 3  4 5 6  7 8  9  10 11 12 13 14 15 16 17 18 19 1
value of A   : 10 3 15 8 1 13 6 18 11 4  16 9  2  14 7  0  12 5  17 10
________________________________________________________________________
					
Similarly, note that B should go through the sequence 0-3 in a consistent
manner:

Table 3:
_______________________________
Y: ...4  3  2  1  0 -1 -2 -3...
B: ...0  3  2  1  0  3  2  1...
______________________________


COMPUTATION OF THE CALENDAR YEAR

     By applying the Gauss formula for two consecutive years, the length of
the Hebrew calendar year is found, and this number contains all the remaining
information needed for constructing the Hebrew calendar for a specific year.
Although the use of routines converting calendar dates to Julian Day numbers
and vice versa are only optional, they can significantly simplify the
procedures. See for example Duffett-Smith[8,9] who presents the relevant
algorithms.

     Here is how it is done:

Table 4:
_____________________________________________________________________________

Method and comments                                         Example
_____________________________________________________________________________
1. Set the year Y                                           Y=5752
2. This overlaps with y1=Y-3761 and y2=y1+1                 y1=1991, y2=1992
3. Go to Table 1, find Passover date for y2                 April 18, 1992
    Optional: Find corresponding Julian Day JD2             JD2=2448730.5	
    Go to Table 1, find Passover date for y1                March 30, 1991
    Optional: Find corresponding Julian Day JD1             JD1=2448345.5	
4. Find L, the number of days including the first and
    excluding the second of the two Passover
    days, or JD2-JD1. This is the length of the year Y.     L=385
5. If L is one of the numbers L=353, 354, 355 then
    Y has 12 months. If L= 383, 384, 385 then Y is a leap
    year having 13 months. An extra 30 days long month is
    then inserted between Shevat and Adar. This month is
    called Adar rishon (first Adar), and on a leap year the next
    month (the usual Adar) is called Adar sheni (second Adar),
    and is always 29 days long.                             5752=Leap year
6. L=354, 384 is the "regular" year, with alternative months
    of 30, 29 days (except the Adar rishon, always
    30 days long, intercalated on a leap year).
    L=353, 383 is the "deficient" year, with the third month
    Kislev of 29 days only. Other months "regular".
    L=355, 385 is the "abundant" year with the second month	
    Heshvan longer, having 30 days. Other months
    are "regular".                                          Y="abundant" year
7. The new year's day of year Y is (always!) the 163rd.
    day after the 15th of Nisan of year Y-1.
    Optional: Julian day for new year's day of year Y
    JD=JD1+163=2448345.5+163
                                                            JD=2448508.5
    New Year's day for year Y is                            Monday,
                                                            September 9, 1991
_____________________________________________________________________________


Finally, we have for year 5752:

Table 5:
__________________________________________________________________________
Month     Month          Days      Starting            Julian Day     Week 	
number    name                     on date             number         day 	
__________________________________________________________________________

1         Tishri         30        September 9, 1991   2448508.5      2
2         Heshvan        30        October 9, 1991     2448538.5      4	
3         Kislev         30        November 8, 1991    2448568.5      6
4         Tevet          29        December 8, 1991    2448598.5      1
5         Shevat         30        January 6, 1992     2448627.5      2
6         Adar rishon    30        February 5, 1992    2448657.5      4
7         Adar sheni     29        March 6, 1992       2448687.5      6
8         Nisan          30        April 4, 1992       2448716.5      7
9         Iyar           29        May 4,1992          2448746.5      2
10        Sivan          30        June 2, 1992        2448775.5      3
11        Tammuz         29        July 2, 1992        2448805.5      5
12        Av             30        July 31, 1992       2448834.5      6
13        Elul           29        August 30, 1992     2448864.5      1
__________________________________________________________________________
  			
Checkpoints:
     The Explanatory Supplement[1] states that the epoch for the Hebrew
calendar is October 7, 3761BCE. The Encyclopaedia Hebraica[3] also states
that the first day of the Creation was a Monday. Verify that the New Year's
day, i.e., 1st of Tishri, of year 1 of the Hebrew calendar was Monday, October
7, 3761BCE, Julian Day number 347997.5.
     The Encyclopaedia Hebraica cites the solar eclipses of June 6, 346CE and
March 15, 359CE, as the benchmarks for integrating the Hebrew calendar to the
astronomical events. Since then the sanctification of the New Moon is only a
ritual, and the Hebrew calendar is set up by computations. Your job is to
verify that June 6, 346CE is the onset of the month of Tammuz of the year
4106, and March 15, 359CE is the onset of the month Nisan of the year 4119.
You will get answers June 8, 346CE, March 16, 359CE, respectively, because the
Hebrew calendar day starts on the previous evening and not at midnight, and
the conditions given in Table 1 can cause additional delays of a day or two.
Astronomical programs (e.g., see Duffett-Smith[9], and his implementation of
the Meeus algorithm) will verify that the corresponding New Moon
(conjunction), which coincides with the eclipse, was indeed at June 6, 346CE
and March 15, 359CE.


PASSOVER AND EASTER SUNDAY

     Easter Sunday is determined by certain rules[1-3] and is also given as an
algorithm for calculator or computer computation[8, 10]. Historical remarks
preceding these discussions indicate that in 325CE it was decided at the
Council of Nicaea that Easter date should be the first Sunday following the
first full moon on or after the vernal (spring) equinox (i.e., about March 21
by the current Gregorian calendar), but additional rules restricted it to be
between March 22 and April 25 (inclusive). As with the Hebrew calendar, Easter
Sunday is nowdays tabulated rather than decided by the original astronomical
events. Apparently the purpose of the original rules was to have Easter Sunday
never occur on the 15 of Nisan of the Hebrew calendar[3]. Has this aim been
achieved? Maybe this question intrigued Gauss and led to his formula given
above. Using the present formalism for the date of the first day of the
Passover, together with an algorithm for the date of Easter, it is easy to
show that since 1583CE into the 23rd. century, the two events do happen
simultaneously, although very rarely. Except for one occurrence in 2143CE,
this always happens in April. Note that no such event occurs in the 17th and
21st centuries. Finally, using an algorithm for the occurrence of the Full
Moon showed that except for three events, the overlap happened on the day
(starting at midnight) of the Full Moon. In the case of the exceptions (marked
below with an asterisk), the Full Moon occurred late at night on the previous
day. Reckoned by the Hebrew calendar day, which starts at sunset on the
previous evening, this is still the same day.


     Here are the dates obtained by the author:
Table 6:
_____________________________________________
Date (m/d/y)       Full Moon on previous day
_____________________________________________
4/19/1609
4/14/1805           *
4/3/1825
4/12/1903
4/1/1923
4/17/1927
4/18/1954
4/19/1981
4/11/2123           *
3/31/2143           *
4/12/2150
4/1/2170
4/19/2201
_____________________________________________


PROGRAMMING HINTS

     The following comments are BASIC oriented, and will be understood by any
computer literate reader. The details of the coding depends on available
programming tools and individual preference. Experience teaches us that
attempting to write out the full programming code instead of explaining the
reasons, invariably leads to unworkable codes.
Here are a few hints:
     1. Once the length of the year L is found (see Table 4), a flag l=0, 1
for a leap year is obtained by computing l=L30-11, where  denotes integer
division. If l=0, or 1, the year is simple, or leap, respectively.
     2. A flag q=1, 0, -1 is obtained by computing q=(L MOD30)-24.
Irrespective whether the year is simple or a leap year, q=-1, 0, 1 for
deficient, regular and abundant years, respectively. From this construct an
expression for the length of Heshvan and Kislev. Heshvan is 30+q-SGN(q+1) days
long, Kislev is 29 +SGN(q+1) days long.
     3. On a regular year the lengths of the months are alternatively 30, 29,
starting with the first month Tishri. The flag q regulates the lengths of
Heshvan and Kislev. On a leap year, controlled by flag l, the extra day of
Adar rishon pops up, making this month 30 day long, together with the
appearance of the Adar sheni, which is the regular Adar now moved one month
further. All this book-keeping can be done with DATA and READ commands and
appropriate IF...THEN...ELSE statements.
     4. Working within a month, trying to compute what Hebrew date corresponds
to what Gregorian one or vice versa is often frustrating. Here you sit with a
computer, and for this simple task you compute on your fingers and toes. An
appropriate GOSUB subroutine with a FOR...NEXT loop or counters of the kind
A=A+1 will enable you to efficiently handle these tasks by scrolling.


APPENDIX: MAJOR JEWISH HOLIDAYS AND ISRAELI NATIONAL HOLIDAYS

     The list of all ecclesiastical events is very long. I have arbitrarily
chosen the events that are of interest in Israel, because of their national
significance, or because they are especially interesting for children. Here is
a partial list of the main events associated with the Hebrew calendar,
especially in Israel:

Table 7:
____________________________________________________________________________
Event                    Hebrew date         comments       example: 1992
                         and rules                          (month/day/year)	
____________________________________________________________________________
New Year (Rosh Hashana)    1st of Tishri     first day of 2      9/9/1991
Atonement (Yom Kippur)    10th of Tishri                         9/18/1991
Tabernacles (Sukkoth)     15th of Tishri     first day of 8      9/23/1991
Dedication (Hanukkah)     25th of Kislev     first day of 8      12/2/1991
New Year for planting     15th of Shevat                         1/20/1992
Feast of Lots (Purim)     14th of Adar       or on Adar sheni    3/19/1992
Passover (Pesach)         15th of Nisan      first day of 7      4/18/1992
Holocaust                 27th of Nisan      if Friday antedate  4/30/1992	
     Memorial Day                            to Thursday
Memorial Day for the       4th of Iyar       if Thursday/Friday  5/6/1992	
     Fallen Soldiers                         antedate to Wednesday
Day of Independence        5th of Iyar       if Friday/Saturday  5/7/1992
                                             antedate to Thursday
33rd day of Crops         18th of Iyar                           5/21/1992
	Counting (Lag b'Omer)			
Liberation of Jerusalem   28th of Iyar                           5/31/1992
Pentecost (Shavuoth)      6th of Sivan                           6/7/1992
Tisha b'av                9th of Av          if Saturday then    8/9/1992
      Fasting Day                            postpone to Sunday
____________________________________________________________________________


ACKNOWLEDGEMENTS

     I wish to express my gratitude to Professors R. Steinitz, Department of
Physics, and Professor A. Altshuler, Department of Mathematics, Ben-Gurion
University of the Negev, Beer Sheva, Israel, for their help and patience.	
				


REFERENCES

[1] Explanatory Supplement to the Astronomical Ephemeris and American
 	Ephemeris and 	Nautical Almanac, Her Majesty's Stationery Office, 1961.
        Note: Since this version was published, a new version is now available 
        (see letters below)
[2] The New Encyclopaedia Britannica, 1987, vol. 15 Macropaedia, entry:
	Calendar.
[3] Encyclopaedia Hebraica (in Hebrew), 1969, vol. 21, entry: Calendar.
	Article by A. Fraenkel.
[4] C.Z. Solonimsky, "Eine allgemeine Formel fuer die gesamte juedische
	Kalenderberechnung", Journ. f. Mathem., 1844.
[5] M. Hamburger, "Ableitung der Gaussschen Formel zur Bestimmung des juedische
	Osterfest", Journ. f. Mathem., 1896.
[6] A. Fraenkel, "Die Berechnung des Osterfestes", Journ. f. Mathem., 1910.
[7] A. Loewy, "Ein Ansatz von Gauss zur juedischen Chronologie aus seinem
	Nachlass", Jahresber. d. Deutschen Math.-Vereinigung, 1918.
[8] P. Duffett-Smith, Practical Astronomy with your Calculator, 3rd Ed.,
	Cambridge University Press, 1988.
[9] P. Duffett-Smith, Astronomy with your Personal Computer, Cambridge
	University Press, 1985, reprinted (with corrections) 1986.
[10] E. Burgess, Celestial BASIC, Astronomy on Your Computer, SYBEX, revised
	edition, 1985.
___________________________________________
The Director
Orbital Mechanics Dept.
US Naval Observatory
Washington, DC 20392

Dear Sir:

The preface of the 1992 new revised
EXPLANATORY SUPPLEMENT TO THE ASTRONOMICAL ALMANAC
cites you as the official address for comments on the book.
Please forward the following to the authority concerned.

I would like to point out an error in the above book:
on page 586, example 1 on computation of the Hebrew calendar
the answer should be Friday, not Thursday as given.

It is a simple mistake because day number 6 at 14 hours (Hebrew day)
corresponds to common calendar day Friday 8 AM (in the morning).

The mistake is too obvious because the example chosen is the Jewish 
traditional
MOLAD ADAM (the traditional date of the creation of man),
which is Friday, first day of month Tishrei, Creation Year 2. If it is worth
mentioning in the book, it is worth mentioning correctly, I would say.

Excepting this, the explanations are excellent. The book is superb.

Sincerely yours,                                            
(-)
Dan Censor
----------------------------------------------------------------------------
US Naval Observatory
Nautical Almanac Office
3450 Massachusetts Avenue NW
Washington, DC 20392-5420

18 May 1994

Professor Dan Censor
Department of Electrical and Computer Engineering
Ben Gurion University of the Negev
Beer Sheva 84105
Israel

Dear  Professor Censor,

Thank you for your letter of 10 April, which Dr. Seidelmann has 
referred to me for reply. You are correct in pointing out
the "too obvious" mistake in my example for calculating the weekday of a
Tishri molad. This will be corrected in future editions of the Explanatory
Supplement.

Sincerely yours,
(-)
L.E. Doggett
Chief, Nautical Almanac Office
  
____________________________________________
(version November 21, 1993)
ascii adapted 21/2/1994
Letters added Nov. 3, 1994
____________________________________________