User:Jc3s5h/YYYY-MM-DD articles

Gregorian calendar
The Gregorian calendar is well-known as a solar calendar, but also incorporates a lunar calendar. The primary purpose of the lunar aspects of the Gregorian calendar are to calculate the date of Easter and associated church observances. The Catholic Encyclopedia explains that since a lunar month (or lunation) is approximately 29.5 days, but it is impractical to deal with a fraction of a day in a calendar, the basic lunar calendar alternates 29-day lunations with 30-day lunations. An ordinary lunar year contains 12 lunations, and 234 days. A method of reconciling the lunar and solar years is often attributed to the Athenian astronomer Meton, and is known as the Metonic cycle or 19-year cycle. In a 19-year cycle, 12 years are ordinary and contain 12 lunations, and 7 years contain 13 lunations. The 13th month is known as the embolismic or intercalary month. While in ancient times all the embolismic lunations contained 30 days, under the Gregorian reform, only 6 of the 7 embolismic lunations contain 30 days; the remaining embolismic lunation contains 29 days.

Much of the presentation in the Catholic Encyclopedia is tabular. Knuth provides an Easter date algorithm, which he attributes to Aloysius Lilius and Christopher Clavius. He states the algorithm "is used by most Western churches to determine the date of Easter Sunday for any year after 1582." This presentation is much more concise than the Catholic Encyclopedia.

Let Y be the year for which the date of Easter is desired.
 * Golden number :Set G to (Y mod 19) + 1. (The golden number is the number of the year in the 19-year Metonic cycle.)
 * Century: Set C to &lfloor;Y/100&rfloor; + 1. (See Floor and ceiling functions. When Y is not a multiple of 100, C is the century number, i.e. 2019 is in the 21st century.)
 * Corrections: Set X to &lfloor;3C/4&rfloor; &minus; 12, Z to &lfloor;(8C + 5)/25&rfloor;. [X is the number of years, such as 1900, in which the leap year was dropped to keep step with the Sun, Z is a special correction designed to synchronize Easter wth the Moon's orbit. The Catholic Encyclopedia article describes this correction as "adding one day to the age of the moon (I. e. to the Epacts) every 300 years seven times in succession and then one day after 400 years (i.e. eight days in 8 X 312.5 or 2500 years)". This correction is known as the Lunar equation.]
 * Find Sunday :Set D to &lfloor;5Y/4&rfloor; &minus; X &minus; 10. [March ((&minus;D mod 7) actually will be a Sunday.]
 * Epact :Set E to 11G + 20 + Z - X mod 30. If E = 25 and the golden number G is greater than 11, or if E = 24, then increase E by 1. (The Catholic Encyclopedia provides the conversion from golden number to epact in the form of a table, valid from 1 BC to AD 1582, where the computus of Dionysius applies, and from AD 1522 to AD 3099. The article states the table may be continued 5199 "with the help of the table equations".)
 * Find full Moon :Set N to 44 &minus; E; If N < 21 then set N to N + 30. [N is N March, and at this point in the algorithm, 1 April would be represented as 32 March, etc. The Catholic Encyclopedia indicates omitting centurial years not divisible by 400 on February 29 creates problems, so these omissions were restored in the Corrections step. This step subtracts 3 days every 400 years, but does so on 1 January, the resulting inaccuracy in the age of the Moon is immaterial because it is outside the part of the year significant for calculating the date of Easter. This correction is known as the Solar equation. An additional traditional requirement is that a new moon (epact 0 or *) not occur twice on the same date a 19-year cycle.]
 * Advance to Sunday :Set N to N + 7 &minus; ((D + N) mod 7).
 * Get month :If N > 31, the date is (N &minus; 31) April; otherwise the date is N March.