# Gaussian algorithm for calculating Easter Sunday

Carl Friedrich Gauss (* 1777 - † 1855) was a prolific German mathematician and physicist who left an indelible mark on many fields of human knowledge. He had a mind for numbers and was said to be able to calculate a comet's trajectory within the span of an hour, a feat that usually took others in his field several days to perform. He also left his mark as a computist in the science of calendar calculations, specifically computus, otherwise known as the calculation of Easter Sunday. According to legend, he had originally restricted this attempt to simply finding out the exact day of his birth. The story goes that he had learned from his mother that his birthday was eight days before the feast of the Ascension of the Lord, which would have been 39 days after Easter Sunday in the year 1777. Unfortunately, he didn’t want to publish the full procedure he used to achieve the result, having limited his publication to the barest formulas and proofs under the pretext that “a finished house should be visible without the scaffolding”. This leaves us today only able to guess as to how the resulting algorithm came about. He published the result of his work at the age of 23 (he already had his doctorate) in the professional journal “Monatliche Correspondenz” in the August issue of 1800. In the resulting formula, he accomplished his calculation without the use of epacts, dominical letters and the like. Below I will try to reconstruct the assembly of that final formula.

For starters, we’ll need to make a simple table of ecclesiastical (paschal) full moons depending on the Golden Number in the Julian calendar. Now, the first ecclesiastical full moon can occur no earlier than 21 March (Golden Number 16) and absolutely no later than 18 April (Golden Number 8). If you recall, the Sunday following the first full moon of spring (ecclesiastical full moon) is Easter Sunday. Looking at the chart below, you’ll see that the penultimate column always contains the March date of that full moon (if the number exceeds 31 March with a number like 32, that would 1, likewise 33 is 2 April, and so on).

Golden
number
Ecclesiastical
full moon
MarchDays from
March 21
1Apr 53615
2Mar 25254
3Apr 134423
4Apr 23312
5Mar 22221
6Apr 104120
7Mar 30309
8Apr 184928
9Apr 73817
10Mar 27276
11Apr 154625
12Apr 43514
13Mar 24243
14Apr 124322
15Apr 13211
16Mar 21210
17Apr 94019
18Mar 29298
19Apr 174827

The Golden number is calculated by dividing the year in question by 19, taking the remainder, and adding 1 to it. The value in the final column regularly decreases by 11 as opposed to the previous row. If we get a number less than 21, we add 30. We keep repeating this until we get to the end of the table. If we subtract 21 from any value in the final column of the table, we get the number of days between the ecclesiastical full moon and 21 March, the beginning of spring as set in place by the church (see the last column). In the formula below, this difference is denoted by the letter d, its value is then obtained using a relatively simple calculation. Let the letter a denote only the remainder after dividing the year by the number 19, and since it’s mathematically impossible for the remainder to be 19 or larger, it takes values from 0 to 18:

a = year % 19
d = (19 × a + 15) % 30

The number 15 is a constant for the Julian calendar. The operator '%' denotes the remainder is the only thing kept after division (e.g. 23 % 5 = 3).

We define other auxiliary variables: b is a cycle of leap years and takes values from 0 to 3. The letter c is a cycle of alternating days of the week, and it takes its values from 0 to 6. Now we can calculate how many days from the ecclesiastical (pascal) full moon that Easter Sunday occurs on. Let the letter e denote this number of days reduced by 1.

b = year % 4
c = year % 7
e = (2×b + 4×c + 6×d + 6) % 7

The formula (2 × b + 4 × c) % 7 calculates the day of the week for the selected day. The equivalent to this is a dominical letter (in the case of a leap year, only the latter applies). The resulting numbers 0, 1, ..., 6 can then be uniquely assigned the Sunday letters C, D, ..., B. We will use this to determine the day of the week for 22 March. The number 0 corresponds to Monday, 1 is Sunday, and all the way up to 6 is Tuesday. Since we are interested in the number of days from Sunday, it is advisable to choose Sunday on the number 0, the added constant 6 will help. The results can be shown in the following small table:

(2×b+4×c+6)%722nd of March
6Monday
5Tuesday
4Wednesday
3Thursday
2Friday
1Saturday
0Sunday

If the day of the week on 22 March had not changed in different years, this formula would have been useless. However, since it changes, the value of the expression decreases by 1 each subsequent non-leap year (for example, if it was Monday on 22 March in a given year and Tuesday on the same leap year, then it decreases by 2 in the leap year).

The expression + 6 × d replaces the expression −d, thus avoiding a negative result in parentheses. This adjustment can be made, because the final result is still only the remainder after dividing by seven, from which we can add seven times any natural number. In this case, we add 7 × d (then 6 × d = −d + 7 × d). The sought date of Easter Sunday is then easy to get. As of 22 March, we add the number of days to the ecclesiastical full moon (d) to the number of days from the ecclesiastical full moon until Easter Sunday (e is already reduced by 1 so we add it to 22 March 22, not to 21 March).

Easter Sunday (March) = d + e + 22

The result is always a March date for Easter Sunday. If we get a number greater than 31, it is necessary to subtract 31 and the result is the April date. Therefore, the following applies to the April date:

Easter Sunday (April) = d + e - 9

All of the formulas and the table used so far apply only to the Julian calendar!

In the Gregorian calendar, the situation is somewhat more complicated due to the solar and lunar correction (see the description of the Easter Sunday calculation). The date of the ecclesiastical full moon then depends on the century. For Golden Number 1, we get this table (a more extensive similar table can be found on the Golden Numbers Series page):

YearsLunar
Correction
Solar
Correction
Full moon date
Up to 1582April 5
1583-1599-3+10April 12
1600-169900April 12
1700-17990+1April 13
1800-1899-1+1April 13
1900-19990+1April 14
2000-209900April 14
2100-2199-1+1April 14
2200-22990+1April 15
2300-23990+1April 16
2400-2499-10April 15
2500-25990+1April 16
2600-26990+1April 17
2700-2799-1+1April 17
2800-289900April 17
2900-29990+1April 18

Due to this complication, the values ​​of the constants used in the formulae for the Julian calendar change. First, though, we need to define auxiliary variables (division here should only be done with whole numbers and without any consideration for the remainder):

k = year / 100
p = (13 + 8 × k) / 25
q = k / 4

The expression itself (k - p - q) shows the difference between the first ecclesiastical full moon of spring in the Julian and Gregorian calendars (see the table above). This expression is used to calculate the value of the constant M (whereas in the Julian calendar, the constant is always 15).

M = (15 + k - p - q) % 30

This calculation of the constant for determining the ecclesiastical full moon caused the greatest difficulty. This problem wasn’t likely due to the author's insufficient mathematical acumen, but rather due to him having the wrong initial information. The monthly correction usually changes after 300 years, but once every 2,500 years it changes after 400 years. The original version was p = k / 3, but later it was found that the formula gives poor results for the year 4200, and the mistake only grows over time. It was several years later that Gauss would correct the calculation.

It was much simpler to adjust the constant to take account of the solar correction (denoted by N), where the expression (k - q - 2) which shows the difference between the calendars in days.

N = (4 + k - q) % 7

We will display both constants depending on the century in a simple table below.

YearsMN
1583-1599222
1600-1699222
1700-1799233
1800-1899234
1900-1999245
2000-2099245
2100-2199246
2200-2299250
2300-2399261
2400-2499251
2500-2599262
2600-2699273
2700-2799274
2800-2899274
2900-2999285

The calculation of the remainder after division (in the case of the constant M, it’s after dividing by 30, and in the case of the constant N it’s from the remainder after dividing by 7) is unnecessary, because in the formulas for d and e, this operation is performed again. However, Gauss did do the same in his progress. The modified formulae for the Gregorian calendar then looked like this (the other formulas for a, b and c are the same as for the Julian calendar):

d = (19 × a + M) % 30
e = (2 × b + 4 × c + 6 × d + N) % 7

then once again:
Easter Sunday (March) = d + e + 22 or:
Easter Sunday (April) = d + e - 9

But this is not the end of our calculation. We must not forget that the latest possible date for Easter Sunday is 25 April. The algorithm shown above generates 26 April for some years. These are, for example, the years 1609, 1981 and 2076. These are the years with epact 24 and the Dominical letter of D. It’s necessary to add an exception. In the cases where d = 29 and e = 6 at the same time, then Easter Sunday is a week earlier, on 19 April. Another exception is due to the special treatment of epact 25 (in this case, Easter Sunday is a week earlier than the latest possible date). This applies, for example, to the years 1954 and 2049. These are the years with epact 25, Sunday letter C and Golden numbers greater than 11 (see the following for more information). For these, it’s necessary to add another complicated condition: if d = 28, e = 6 and a > 10, and if all of these conditions are true at the same time, then Easter Sunday is on 18 April (if you remember, a is actually the Golden Number reduced by 1; initially this last part of the condition was even more complicated: (11 × M + 11) % 30 < 19).

 a = year % 19 b = year % 4 c = year % 7 k = year / 100 p = (13 + 8 * k) / 25 q = k / 4 M = (15 − p + k − q) % 30 N = (4 + k − q) % 7 d = (19 * a + M) % 30 e = (2 * b + 4 * c + 6 * d + N) % 7 if (d + e + 22) is less than 32, then Easter Sunday is (d + e + 22) of March if d is equal to 29 and at the same time e is equal to 6, then Easter Sunday is April 19 if d is equal to 28 and at the same time e is equal to 6 and at the same time 'a' is greater than 10, then Easter Sunday is 18 April otherwise it is Easter Sunday (d + e - 9) of April

Thanks to all of this, Gauss finally discovered that in 1777, Easter Sunday was 30 March. The Feast of the Ascension dates are 39 days after Easter, and since he was born eight days before those feasts, he could then easily calculate his birthdate as 30 April, 1777.

## Attempt to improve the algorithm

Interestingly, Gauss used this formula to determine the day of the week for the selected day: (2 × b + 4 × c) % 7, which requires two more previous calculations to determine b and c with the formula, (year + year / 4) % 7. Although the numbers for individual days of the week gradually increase, we can adjust the formula for calculating e based on this behaviour. The result then looks like this:

bc = (year + year / 4) % 7
e = (35 + N - bc - d) % 7

Constant 35 only prevents the possibility of a negative number in parentheses; any larger number divisible by 7 can be used. Or, you can use the same method as used by Gauss and add seven times the subtracted expression, which causes the formula for e to looks like this:

e = (N + 6 × (bc + d)) % 7

Rows for calculating b and c are no longer needed, so we save a row. We can also simplify the conditions. In the Gregorian calendar, the most recent ecclesiastical full moons are 'shrunk', see the table:

depactEcclesiastical
full moon
2627April 16
2726April 17
2825/25April 17/18
2924April 18

After calculating d (which is the number of days between the cyclic full moon and March 21), we can adjust its value as follows:

if d is equal to 29, then d = d - 1
or if d is equal to 28 and at the same time 'a' is greater than 10, then d = d - 1

This treated epact 24 and special epact 25. No further conditions are needed, the other lines remain unchanged. This abbreviated algorithm, of course, then gives the same results as the original Gaussian algorithm.

 a = year % 19 bc = (year + year / 4 ) % 7 k = year / 100 p = (13 + 8 * k) / 25 q = k / 4 M = 15 − p + k − q N = 4 + k − q d = (19 * a + M) % 30 if d is equal to 28 and at the same time 'a' is greater than 10, then d = d - 1 if d is equal to 29, then d = d - 1 e = (35 + N - bc - d) % 7 if (d + e + 22) is less than 32, then Easter Sunday is (d + e + 22) of March otherwise it is Easter Sunday (d + e - 9) of April