How Common is Easter in March?
"Easter is March 31 this year," my husband said. "I think that's rare, having Easter in March."
"I guess so," I said.
"There's a Cray somewhere that they use to calculate the date each year," he joked.
And of course that made me want to find out if Easters in March really are rare.
Roughly, Easter happens on the Sunday after the first full moon after the vernal equinox. That's not quite right: there are complications, and there are also variations (not all churches calculate Easter in the same way).
Jean Meeus, Astronomical Algorithms, has an algorithm for the date of Easter, as does the much more readable Practical Astronomy With Your Calculator (looks like there's a newer edition that covers spreadsheets too). (Disclosure: I get a small kickback if you purchase through those Amazon links.) I'm pretty sure PyEphem has it built in. But I bet there's something in the Python standard library too.
Well, no, it's not in the standard library, but there's dateutil.easter. That makes it simple to explore how common March Easters are (letting dateutil.easter.easter default to EASTER_WESTERN rather than using the Julian or Orthodox algorithms).
from dateutil import easter num_in_march = 0 earliest_day = 31 for i in range(1900, 2100): easterdate = easter.easter(i) if easterdate.month == 3: num_in_march += 1 print(easterdate) earliest_day = min(earliest_day, easterdate.day) print("Earliest Easter on March", earliest_day) print(f"Percent in March: {num_in_march * 100 // 200}% ({num_in_march}/200)")
Turns out there are 44 Easters between 1900 and 2099 that fall in March, or 22%, with the earliest being on March 23rd.
So, not rare at all, and no Cray needed. Aren't computers fun?
[ 12:49 Mar 10, 2024 More programming | permalink to this entry | ]