In the current Hebrew calendar, there are 3 intercalation points:

- The leap month of Adar I, having 30 days, may be added between Shevat and Adar (II).
- The month of Cheshvan may have either 29 or 30 days.
- The month of Kislev may have either 29 or 30 days.

The remaining ten months have a fixed length of 295 days. Therefore, there are 6 possible lengths of a year:

- 353 days
- 354 days
- 355 days
- 383 days
- 384 days
- 385 days

Using the calculation in my previous post, the frequency count of calendar year lengths over the full 592-year cycle are:

- 353: 67
- 354: 122
- 355: 166
- 356: 19
- 382: 2
- 383: 101
- 384: 32
- 385: 83

As in the existing Hebrew calendar, the illegal year lengths will be "fixed" by adding more postponement rules. First, let's address the 356-day years. These occur when the year (

*anno mundi*) modulo 592 falls in the set {45, 65, 72, 92, 143, 163, 170, 241, 312, 319, 339, 390, 410, 417, 437, 488, 515, 559, 586}, and start on a Tuesday.

We can shorten the year to a valid length of 355, 354, or 353 days by postponing Rosh Hashana to Wednesday, Thursday, or Friday, respectively. Since Rosh Hashana cannot occur on Wednesday or Friday, the only choice is Thursday. So, Rosh Hashana will be postponed by 2 days.

After making this change, the distribution of year lengths becomes:

- 353: 59
- 354: 141
- 355: 174
- 382: 2
- 383: 90
- 384: 32
- 385: 94

The 382-day years occur when the

*anno mundi* year, modulo 592, is 210 or 457. These years start Thurdays. We could increase their length to a legal 384 days by making Rosh Hashana 2 days earlier, but months aren't supposed to start before the molad.

Instead, we will postpone the start of the

*following* years, i.e., 211 and 458 of the 592-year cycle. These years would otherwise start on Monday and be 355 days long. Postponing Rosh Hashana to Tuesday (which is valid) makes them 354 days long (which is also valid).

The final Rosh Hashana computation with all the postponement rules in place is:

Code: Select all

```
from datetime import date
from fractions import Fraction
MONTH_LENGTH = 29 + Fraction(555, 1046)
YEAR_LENGTH = 365 + Fraction(143, 592)
Y2K_MOLAD_JJD = 2451549 + Fraction(878282, 928848)
Y2K_EQUINOX_JJD = 2451623 + Fraction(587001, 928848)
def floor(frac):
return frac.numerator // frac.denominator
def ceil(frac):
return -floor(-frac)
def rosh_hashana(year):
equinox_jjd = Y2K_EQUINOX_JJD + (year - 5761) * YEAR_LENGTH
# Molad of Tishrei = first new moon at least 163 days after equinox
lunation_number = ceil((equinox_jjd + 163 - Y2K_MOLAD_JJD) / MONTH_LENGTH)
molad_jjd = Y2K_MOLAD_JJD + lunation_number * MONTH_LENGTH
# Rosh Hashana starts at JJD x.0 after the molad.
# Dehiyyah Molad Zaken: If molad time >= noon, postpone RH by a day.
rh_jjd = floor(molad_jjd + Fraction(1, 4))
rh = date.fromordinal(int(rh_jjd) - 1721424)
# Dehiyyah Lo ADU
# If RH would be on Sun, Wed, or Fri, postpone it
if rh.weekday() in (6, 2, 4):
rh += timedelta(days=1)
# Dehiyyah GaTaRaD
# Shorten 356-day years to 354 days
if year % 592 in (45, 65, 72, 92, 143, 163, 170, 241, 312, 319, 339, 390,
410, 417, 437, 488, 515, 559, 586):
rh += timedelta(days=2)
# Dehiyyah BeTUTeKaPoT
# Eliminate 382-day years by shorting the subsequent years
if year % 592 in (211, 458):
rh += timedelta(days=1)
return rh
```

and the frequency count of year lengths is:

- 353: 59
- 354: 143
- 355: 172
- 383: 92
- 384: 32
- 385: 94