Skip to content

Instantly share code, notes, and snippets.

@trivektor
Created July 18, 2011 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trivektor/1089840 to your computer and use it in GitHub Desktop.
Save trivektor/1089840 to your computer and use it in GitHub Desktop.
How to calculate Easter Sunday
# created by Nathan Broadbent (http://madebynathan.com/2011/03/31/thanks-first-council-of-nicaea/)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment