I wanted the LCD screen on my apartment door to display a message on certain days, such as birthdays, Christmas, and Easter. I didn’t realize how hard it was to calculate which day Easter Sunday is…
def easter(year) c=year/100 n=year-19*(year/19) k=(c-17)/25 i=c-c/4-(c-k)/3+19*n+15 i-=30*(i/30) i-=(i/28)*(1 -(i/28)_(29/(i+1))_((21-n)/11)) j=year+year/4+i+2-c+c/4 j-=7*(j/7) l=i-j month=3+(l+40)/44 day=l+28-31*(month/4) [day, month] end
This happens to be the first Sunday after the Paschal full moon following the northern hemisphere’s vernal equinox.
Christmas, for comparison:
def christmas(year) [25, 12] end