Easter is the most important Christian holiday which celebrates the the resurrection of Christ from the dead (strangely enough, the name for the festival comes from the name of the long forgotten Germanic goddess of the radiant dawn: Ēostre). It is a movable feast - and the task of determining the precise date caused much problems for the monks and scholars over the ages.
The task was called Computus - from latin: the calculation, and it was indeed the calculation of its age. The story of how the Easter date was computed is quite curious and I recommend reading the very interesting article on the Wiki: link.
One of the algorithms for the Easter date computation was proposed by the famous Carl Friedrich Gauss in 1800. The algorithm is:
function easter(year):
a ← year mod 19
b ← year mod 4
c ← year mod 7
k ← floor (year/100)
p ← floor (13 + 8k)/25
q ← floor (k/4)
M ← (15 − p + k − q) mod 30
N ← (4 + k − q) mod 7
d ← (19a + M) mod 30
e ← (2b + 4c + 6d + N) mod 7
if 22+d+e <= 31:
month ← 3
day ← 22+d+e
else:
month ← 4
day ← d + e - 9
if day == 26:
day ← 19
end
if day == 25 and (11M + 11) mod 30 < 19:
day ← 18
end
end
return (year, month, day)
It should be easy to code that down in any language you know. Sample JS implementation is available below. Isn't it nice that the next year's Easter falls on the Fools Day?
The task was called Computus - from latin: the calculation, and it was indeed the calculation of its age. The story of how the Easter date was computed is quite curious and I recommend reading the very interesting article on the Wiki: link.
One of the algorithms for the Easter date computation was proposed by the famous Carl Friedrich Gauss in 1800. The algorithm is:
function easter(year):
a ← year mod 19
b ← year mod 4
c ← year mod 7
k ← floor (year/100)
p ← floor (13 + 8k)/25
q ← floor (k/4)
M ← (15 − p + k − q) mod 30
N ← (4 + k − q) mod 7
d ← (19a + M) mod 30
e ← (2b + 4c + 6d + N) mod 7
if 22+d+e <= 31:
month ← 3
day ← 22+d+e
else:
month ← 4
day ← d + e - 9
if day == 26:
day ← 19
end
if day == 25 and (11M + 11) mod 30 < 19:
day ← 18
end
end
return (year, month, day)
It should be easy to code that down in any language you know. Sample JS implementation is available below. Isn't it nice that the next year's Easter falls on the Fools Day?
Date of the easter for the year is: (date here)
HAPPY EASTER!
No comments:
Post a Comment