Mathematics of the Jewish Calendar/The long-term accuracy of the calendar
The mathematics of the Jewish calendar with all their minutiae are accepted Jewish law and have undoubtedly been so for well over a thousand years. Thus they cannot be altered until a Sanhedrin can be convened, which is not possible at present. Thus it is interesting to ask how well the current rules met the two requirements in Jewish law: do the new months correspond with the first visibility of the New Moon, and will Pesach always fall in the Spring? There are also issues around the Prayer for Rain and the Blessing of the Sun.
The assumed average length of the month, the interval between two consecutive molads, is accurate to a fraction of a second according to the latest scientific knowledge. In making a long-term assessment of accuracy, it must be remembered that the motion of the Moon is very complex, and the average length of a month is varying over time. Further, the rotation of the Earth is slowing down; while the motion of the Moon is predicted using days of constant length, the Jewish calendar necessarily works with the day and night cycle, which is very slowly getting longer. Making the best possible forecasts of both effects, it seems that the formula for the Molad will not be in serious error in the next 3,000 years. Forecasts further ahead become very uncertain.
However, there are short-term irregularities in the Moon's motion, so the month constantly varies in length. As a result, the date and time of the Molad may be a few hours different from the true moment of New Moon. The main variation has an annual cycle, and since it is only the Molad of Tishri that determines the calendar, this annual cycle has little effect.
Agreement with the first visibility of the New Moon is more difficult to assess, since the visibility cannot be predicted with any certainty and will vary with latitude, longitude, altitude and other factors. However, there is no reason to believe that the mean interval between New Moon and first visibility is changing, so that as long as the Molad stays close to the true time of New Moon there should be no big problem.
The date of Pesach
This is a much bigger problem than the Molad. The 19 year cycle is quite accurate, and far more accurate than any shorter cycle. However, it is not perfect. The average length of the Jewish year over a 19 year cycle is about 365 days, 5 hr, 55 min, 25.4 sec. This is 6 min, 40.2 sec longer than the current average value of the solar year (though that is changing very slowly) and 6 min, 13.4 sec longer than the average value of the year in the Gregorian calendar (which is itself slightly too long).
As a result, the average date of the first day of Pesach is getting later by one day in about 216 years compared to the Sun and 231 years compared to the Gregorian calendar. Thus it is already on average a few days later than at the time of Hillel II. In a 19 year cycle, Pesach currently occurs a month later than on the first Full Moon after the vernal equinox in the 8th, 11th and 19th year of each 19 year cycle, such as 2005, 2008 and 2016CE. This is still not inconsistent with Pesach falling in the Spring. However, the problem will get worse over the centuries. In 18,876 (15,115 CE), the first day of Pesach will be on 22nd June, clearly in the Summer, not the Spring.
In the Jewish year 25,963 (22,203 CE), Rosh Hashana will fall on 1 January. It will always fall on or after that date from 32,849 (29,088 CE). This reduces the difference between the Jewish and civil years at the date of Rosh Hashana by one. A further drift of the Jewish calendar through the Gregorian year will take roughly another 84,500 years, after which the difference will have decreased by one again.
Thus eventually the number of the Gregorian year will equal or exceed the number of the Jewish year, although this will take a very long time. The difference between these calendars averages 0.004322 days per year. So to remove a difference of 3761 years will take roughly 3761 x 365.2425/0.004322 or nearly 318 million years.
The Tropical Year
The previous section refers to the Gregorian calendar. As noted above, the drift with respect to the true motion of the sun is slightly faster. Conversely, since the Julian calendar assumes an even greater value for the length of the year, the average date of the first day of Pesach is getting earlier with respect to that calendar.
Assuming 365.24219 days for the tropical year, to do better than the 19 year cycle with a fixed cycle would require a cycle of 182 years (67 leap, 115 ordinary) containing 2,251 months. Even this cycle would be out by one day in 256 years, compared with one day in 216 years for the 19 year cycle.
A much better approximation is a cycle of 334 years (123 leap, 211 ordinary), with an error of a day in about 47,000 years; this is in fact considerably more accurate than the Gregorian calendar, which has a 400 year cycle with an error of a day in about 3,200 years.
The Prayer for Rain and the Blessing of the Sun
The problem with these is even worse than for Pesach (except for the prayer for rain in Israel), since the calculation of dates assumes a year of 365 days 6 hours, or 10 mins 48 seconds longer than the Gregorian year. Thus the dates get later (compared with the Gregorian calendar) by three days in four centuries. Eventually the starting date for the prayer for rain outside Israel will fall on or after the start of Pesach, which will cause a problem. It has been claimed that this happens for the first time in 37,258 CE.
Do not look too far ahead
There is a widespread belief that the calendar should not be calculated after the year 6,000, i.e. 2240 CE, since it is assumed that the Prophet Elijah will have come by then to announce the end of the Jewish exile. This would allow a new Sanhedrin, which could alter the Jewish calendar. Thus the problems discussed above should not arise.