Sunday, August 7, 2016

HP 48G: When is Easter?

HP 48G:  When is Easter?

The following program will accurately calculate the date when Easter occurs.  Special thanks to Peter Ketel for furnishing this program to me and he has given me permission to share it on this blog.  Much appreciated, Peter!

This should be able to be adopted on the HP 49G and HP 50G easily.

HP 48G Program EASTER (591 bytes)
≪ → y
≪ y 19 MOD 1 + y
100 / FLOOR 1 + DUP
OVER 3 * 4 / FLOOR
12 – SWAP 8 * 5 +
25 / FLOOR 5 - → a b c d
≪ y 5 * 4 /
FLOOR 10 – c – 11 a *
20 + d + c – 30
MOD 30 + 30 MOD → e f
≪ IF f 24 == f 25 == a 11 >
AND OR
THEN f 1 + ‘f’ STO END
44 f – DUP
IF 21 < THEN 30 + END → g
≪ g 7 + e g
+ 7 MOD – DUP
IF 31 > THEN 31 - .0001 * .04
ELSE .0001 * .03 END
+ y +
≫ ≫ ≫ ≫ ≫

Input:  Enter the year and run the program

Tests and Results:

1976 returns 1976.0418  (April 18, 1976)
1985 returns 1985.0407  (April 7, 1985)
2017 returns 2017.0416  (April 16, 2017)
2050 returns 2050.041  (April 10, 2050)

This blog is property of Edward Shore, 2016.