Easter Sunday

November 30, 2019

Long ago, I was writing an app to add holidays to a calendar. Finding Easter (or, Western Easter to be exact) was difficult.

I looked at the Wiki and it states:

“The Sunday following the full Moon which falls on or after the equinox will give the lawful Easter.”

https://en.wikipedia.org/wiki/Easter

Then I delved into finding an algorithm for the full Moon. Needless to say, it was quite complex. So I ended up implementing a fixed rule and moved on. That is, copy the next 10 years worth of easter dates and place it in the rule so that it acted as a lookup.

I wasn’t happy with the solution but it worked.

Later on, I ran into an exercise in TAOCP Volume 1. There it was. It was an MMIX exercise but having it in C# won’t hurt.

C# Implementation can be found at https://github.com/keenam/Codyssey/blob/master/Codyssey.Extensions/WesternEaster.cs with function: GetEasterSunday


© 2023 Kee Nam