Calculating the Date of Easter

Of all the annual holidays, Easter is the most difficult date to predict. It’s always a Sunday, but which one? It could land in March or April. Most people look at a calendar or (these days) use Google to find out when Easter occurs. Yet, you can write a program that tells you exactly when Easter falls.

The reason behind Easter’s changing date is that it’s based on a lunar calendar, not the standard solar calendar in common use. Easter occurs on the first Sunday after the first full moon after the vernal equinox.

The vernal (spring) equinox is always around March 20th or 21st. That’s because the solar calendar we use is pretty accurate. Indeed, having such a predictable date for the equinox is why the Julian and then Gregorian calendar reforms occurred.

The first full moon after the vernal equinox marks the Jewish passover. It can occur right after March 20/21 or it could be up to 28 days later, in April. Easter is then celebrated on the following Sunday.

To calculate the date upon which Easter falls, you must know the date of the equinox and the lunar full-moon cycle as well as the day of the week upon which the full moon falls. To gather those variables, you use a formula. This formula is so famous, it has its own name: the computus.

In Figure 1, you see pseudocode presented. It’s what’s known as the Anonymous Gregorian algorithm, which first appeared in the journal Nature in 1876.

Figure 1. The Anonymous Gregorian computus algorithm.

The algorithm works top-down: Variables are a through m (I wrote l in uppercase, L, to be clear); Y is the year value; mod is the modulus operation; floor is a mathematical function that rounds down to the next integer. At the end of the operation, values month and day indicate the month (3 for March, 4 for April) and day on which Easter falls for year Y.

Your task for this month’s Exercise is to use the Anonymous Gregorian computus algorithm to calculate the dates upon which Easter falls. You must write two programs: The first displays Easter’s day for years 2001 through 2021. The second program displays the date of Easter for the current year only.

I’ll present my solution in a week.

Leave a Reply