Post Reply 
(12C Platinum) Day of Easter
09-04-2016, 03:45 PM (This post was last modified: 09-04-2016 03:57 PM by Eddie W. Shore.)
Post: #1
(12C Platinum) Day of Easter
Instructions: Enter the four digit year. Press [ R/S ]. The month will be displayed (stored in R1). Press [ R/S ] to get the day (stored in R2).

For background information and notes, click here: http://edspi31415.blogspot.com/2016/09/h...aster.html

HP12C Platinum Program: Easter
Code:

STEP    CODE               KEY    Notes
001    44, 0            STO 0    Store year (y)
002    1               1     
003    25              %     
004    43, 25          INTG     
005    44, 1              STO 1    Store c
006    44, 4              STO 4    Start i
007     36              ENTER    To fill the stack
008    36              ENTER     
009    4              4     
010    10              ÷     
011    43, 25         INTG     
012    44, 30, 4     STO- 4     
013    33             R↓      
014    36             ENTER     
015    36              ENTER     
016    1             1     
017    7             7     
018    30             -     
019    2             2     
020    5             5     
021    10             ÷     
022    43, 25     INTG     
023    44, 3            STO 3          Store k
024    30            -     
025    3            3     
026    10            ÷     
027    43, 25    INTG     
028    44, 30, 4    STO- 4     
029    1            1     
030    5            5     
031    44, 40, 4    STO+ 4     
032    45, 0            RCL 0     
033    1            1     
034    9            9     
035    10            ÷     
036    43, 40    LSTx       LSTx is [ g ] [ + ] on the Platinum
037    34            X<>Y     
038    43, 24    FRAC     
039    20            *         y MOD 19
040    44, 2            STO 2         Store n
041    1            1     
042    9            9     
043    20            *     
044    44, 40, 4    STO+ 4     
045    45, 4            RCL 4     
046    3            3     
047    0            0     
048    10            ÷     
049    43, 40    LSTx     
050    34            X<>Y     
051    43, 24    FRAC     
052    20            *     
053    44, 4            STO 4     i MOD 30
054    2             2     
055    7            7     
056    45, 4            RCL 4     
057    43, 44    x≤y            Is i≤27?
058    43, 33, 080    GTO 080    If so, go to step 080
059    2            2     
060    9            9     
061    45, 4            RCL 4     
062    1            1     
063    40            +     
064    10            ÷     
065    43, 25     INTG     
066    20            *     
067    1            1     
068    34             X<>Y     
069    30            -     
070    2            2     
071    1            1     
072    45, 2           RCL 2     
073    30            -     
074    1           1     
075    1           1     
076    10           ÷     
077    43, 25    INTG     
078    20            *     
079    44, 30, 4    STO- 4     
080    45, 0             RCL 0     
081    45, 2            STO 2      Start j
082    4            4     
083    10            ÷     
084    43, 25    INTG     
085     44, 40, 2    STO+ 2     
086    45, 4            RCL 4     
087    2            2     
088    40            +     
089    45, 1            RCL 1     
090    30             -     
091    44, 40, 2    STO+ 2     
092    45, 1            RCL 1     
093    4            4     
094    10            ÷     
095    43, 25    INTG     
096    44, 40, 2    STO+ 2     
097    45, 2            RCL 2     
098    7            7     
099    10            ÷     
100    43, 40    LSTx     
101    34            X<>Y     
102    43, 24    FRAC     
103    20            *     
104    44, 2            STO 2           j MOD 7
105     45, 4            RCL 4     
106    34            X<>Y     
107    30            -     
108    44, 3            STO 3     Store l
109    4            4     
110    0            0     
111    40            +     
112    4            4     
113    4            4     
114    10            ÷     
115    43, 25    INTG     
116    3            3     
117    40            +     
118    44, 1            STO 1           Store month (m)
119    31            R/S           Displays m
120    4            4     
121    10            ÷     
122    43, 25    INTG     
123    3            3     
124    1            1     
125    20            *     
126    16            CHS     
127    2            2     
128    8            8     
129    40            +     
130    45, 3            RCL 3     
131    40            +     
132    44 , 2            STO 2         Store day (d)
133    43, 33, 000    GTO 000     Stop, display d

Examples and Test Data:

2016: 3, 27
Keystrokes: 2016 [R/S] [R/S]

1995: 4, 16
2124: 4, 2
1977: 4, 10
2017: 4, 16
1826: 3, 26

These results have been verified.

Source: The United States Naval Observatory “The Date of Easter” March 11, 2016. http://aa.usno.navy.mil/faq/docs/easter.php Retrieved September 2, 2016
Visit this user's website Find all posts by this user
Quote this message in a reply
09-12-2016, 11:00 PM
Post: #2
RE: (12C Platinum) Day of Easter
Thanks, Eddie, for posting. I'm curious, on your 12C Platinum, what date are you getting for Easter 1950? I don't have a Platinum, so I am running it on my HP-67 simulator and a modified version on my HP-38C simulator. I get Apr 2 on the 38 (which I think is a week early) and I get something else on the 67 that isn't even a real date. I'm curious what date you get on the real McCoy.

Thanks,
Bob


Regards,
Bob
Find all posts by this user
Quote this message in a reply
09-12-2016, 11:46 PM
Post: #3
RE: (12C Platinum) Day of Easter
I get April 9, 1950 on my 50g program.
Find all posts by this user
Quote this message in a reply
09-13-2016, 01:26 AM
Post: #4
RE: (12C Platinum) Day of Easter
(09-12-2016 11:46 PM)Bob Patton Wrote:  I get April 9, 1950 on my 50g program.

On my HP-42S program I get

Carnival: Feb-19-1950
  Easter: Apr-09-1950


(Just tested it on Free42 on my cell phone)

Longer (a direct conversion of a Basic program) and a somewhat limited range (1900 <= year <= 2099), but includes Carnival. I used it to choose my next year's vacation time in order to optimize vacation length :-)
Find all posts by this user
Quote this message in a reply
09-14-2016, 04:36 AM
Post: #5
RE: (12C Platinum) Day of Easter
For what it's worth, I'm posting my program for the HP-38C simulator, RPN-38CX. Since this simulator is limited to 99 steps, I loaded all the constants into registers, even financial registers, and replaced many of the arithmetic operators with RCL arithmetic to save steps. This modified program works for most years, but gives a result that is off by one week for 1930, 1950, 1970, 1974, and 1994 in the last century and 2025, 2045, 2065, 2069 & 2089 in the current century. I'm hoping someone might spot where this is going wrong for those years. I suspect it may be a result of the simulator having much greater internal precision (about 15-16 digits) than an actual HP-12C platinum. I think some of you have the RPN-38 CX simulator.

This program requires the following constants be loaded in order to work and for the date format to be set to D.MY format. If you select and copy all of the constants, you can copy to the display of RPN-38 CX and they will be pasted into the correct registers.

R5: 100
R6: 17
R7: 1
R8: 25
R9: 3
R.0: 4
R.1: 19
R.2: 30
R.3: 11
R.4: 2
R.5: 7
R.6: 40
R.7: 44
R.8: 31
R.9: 28
n: 15
i: 29
PV: 21
PMT: 27
FV: 0.000001

Program listing: (in program mode, copy and paste the program steps to the display to copy the entire program)

01 - 21 0 STO 0
02 - 22 71 5 RCL ÷ 5
03 - 24 61 INTGR
04 - 21 1 STO 1
05 - 21 4 STO 4
06 - 31 ENTER
07 - 86 71 0 RCL ÷ .0
08 - 24 61 INTGR
09 - 21 41 4 STO − 4
10 - 25 33 R↓
11 - 31 ENTER
12 - 22 41 6 RCL − 6
13 - 22 71 8 RCL ÷ 8
14 - 24 61 INTGR
15 - 21 3 STO 3
16 - 41 −
17 - 22 71 9 RCL ÷ 9
18 - 24 61 INTGR
19 - 21 41 4 STO − 4
20 - 22 11 RCL n
21 - 21 51 4 STO + 4
22 - 22 0 RCL 0
23 - 86 71 1 RCL ÷ .1
24 - 25 61 FRAC
25 - 86 61 1 RCL × .1
26 - 21 2 STO 2
27 - 86 61 1 RCL × .1
28 - 21 51 4 STO + 4
29 - 22 4 RCL 4
30 - 86 71 2 RCL ÷ .2
31 - 25 61 FRAC
32 - 86 61 2 RCL × .2
33 - 21 4 STO 4
34 - 22 14 RCL PMT
35 - 22 4 RCL 4
36 - 25 5 x≤y
37 - 25 7 53 GTO 53
38 - 22 12 RCL i
39 - 22 4 RCL 4
40 - 22 51 7 RCL + 7
41 - 71 ÷
42 - 24 61 INTGR
43 - 61 ×
44 - 1 1
45 - 33 x≷y
46 - 41 −
47 - 22 13 RCL PV
48 - 22 41 2 RCL − 2
49 - 86 71 3 RCL ÷ .3
50 - 24 61 INTGR
51 - 61 ×
52 - 21 41 4 STO − 4
53 - 22 0 RCL 0
54 - 21 2 STO 2
55 - 86 71 0 RCL ÷ .0
56 - 24 61 INTGR
57 - 21 51 2 STO + 2
58 - 22 4 RCL 4
59 - 86 51 4 RCL + .4
60 - 22 41 1 RCL − 1
61 - 21 51 2 STO + 2
62 - 22 1 RCL 1
63 - 86 71 0 RCL ÷ .0
64 - 24 61 INTGR
65 - 21 51 2 STO + 2
66 - 22 2 RCL 2
67 - 86 71 5 RCL ÷ .5
68 - 25 61 FRAC
69 - 86 61 5 RCL × .5
70 - 21 2 STO 2
71 - 22 4 RCL 4
72 - 33 x≷y
73 - 41 −
74 - 21 3 STO 3
75 - 86 51 6 RCL + .6
76 - 86 71 7 RCL ÷ .7
77 - 24 61 INTGR
78 - 22 51 9 RCL + 9
79 - 21 1 STO 1
80 - 86 71 0 RCL ÷ .0
81 - 24 61 INTGR
82 - 86 61 8 RCL × .8
83 - 32 CHS
84 - 86 51 9 RCL + .9
85 - 22 51 3 RCL + 3
86 - 22 1 RCL 1
87 - 22 71 5 RCL ÷ 5
88 - 51 +
89 - 22 15 RCL FV
90 - 22 61 0 RCL × 0
91 - 51 +
92 - 25 7 00 GTO 00


Regards,
Bob


Regards,
Bob
Find all posts by this user
Quote this message in a reply
09-14-2016, 01:20 PM
Post: #6
RE: (12C Platinum) Day of Easter
(09-14-2016 04:36 AM)bshoring Wrote:  For what it's worth, I'm posting my program for the HP-38C simulator, RPN-38CX. Since this simulator is limited to 99 steps, I loaded all the constants into registers, even financial registers, and replaced many of the arithmetic operators with RCL arithmetic to save steps.

May I draw your attention to this 95-step program for the 29C? I think it can be ported to other calculators. However, the 38C is a bit tricky since a modulo subroutine is called and the 38C offers no GSB. The program can even be shortened as the linked version calculates all easter dates in the entered year and the following ones. If you don't need this simply omit steps 83...86.
Hint: the "print this article" link retrieves a PDF.

(09-14-2016 04:36 AM)bshoring Wrote:  Program listing: (in program mode, copy and paste the program steps to the display to copy the entire program)

Bob, if you use [​code] and [​/code] tags around your listing it will be properly formatted:

Code:
01 - 21 0        STO 0
02 - 22 71 5     RCL ÷ 5
03 - 24 61       INTGR
04 - 21 1        STO 1
05 - 21 4        STO 4
06 - 31          ENTER
07 - 86 71 0     RCL ÷ .0
08 - 24 61       INTGR
09 - 21 41 4     STO - 4
...

Dieter
Find all posts by this user
Quote this message in a reply
09-14-2016, 08:40 PM (This post was last modified: 09-14-2016 10:46 PM by Dieter.)
Post: #7
RE: (12C Platinum) Day of Easter
(09-14-2016 01:20 PM)Dieter Wrote:  May I draw your attention to this 95-step program for the 29C? I think it can be ported to other calculators. However, the 38C is a bit tricky since a modulo subroutine is called and the 38C offers no GSB.

Here is a 12C version of this algorithm. It does not require any subroutine calls and takes advantage of the DATE function which allows the code to fit in 94 lines. This way even the date format setting is observed (MM.DDYYYY or DD.MMYYYY). I did not try this on a 38C/E but it looks like this should run on these as well.

Code:
01  INTG
02  STO 1
03  STO 0
04  1
05  9
06  /
07  INTG
08  1
09  9
10  *
11  STO-0
12  RCL 0
13  1
14  1
15  STO*0
16  /
17  STO 2
18  4
19  4
20  STO+0
21  1
22  RCL 1
23  %
24  INTG
25  +
26  3
27  2
28  %
29  .
30  2
31  +
32  INTG
33  STO+0
34  R↓
35  7
36  5
37  %
38  INTG
39  STO 3
40  STO-0
41  RCL 0
42  3
43  0
44  /
45  INTG
46  3
47  0
48  *
49  STO-0
50  RCL 2
51  RCL 0
52  x<=y?
53  GTO 55
54  GTO 57
55  1
56  +
57  STO 4
58  CHS
59  RCL 1
60  .
61  8
62  /
63  INTG
64  +
65  RCL 3
66  -
67  3
68  +
69  STO 0
70  7
71  /
72  INTG
73  7
74  *
75  RCL 0
76  -
77  RCL 4
78  -
79  5
80  4
81  +
82  RCL 1
83  EEX
84  6
85  /
86  3
87  .
88  0
89  3
90  +
91  X<>Y
92  DATE
93  FIX 6
94  GTO 00

If you feel that using the date function is cheating: it can also be done in 99 steps without it. ;-)

For the record, here is a version for the 67/97 that uses only standard functions.

Code:
001  LBL A
002  INT
003  STO 1
004  STO 0
005  1
006  9
007  /
008  INT
009  1
010  9
011  *
012  STO-0
013  RCL 0
014  1
015  1
016  STO*0
017  /
018  STO 2
019  4
020  4
021  STO+0
022  1
023  RCL 1
024  %
025  INT
026  +
027  3
028  2
029  %
030  .
031  2
032  +
033  INT
034  STO+0
035  R↓
036  7
037  5
038  %
039  INT
040  STO 3
041  STO-0
042  RCL 0
043  3
044  0
045  /
046  INT
047  3
048  0
049  *
050  STO-0
051  RCL 2
052  RCL 0
053  x>y?
054  GTO 2
055  1
056  +
057  LBL 2
058  STO 4
059  CHS
060  RCL 1
061  .
062  8
063  /
064  INT
065  +
066  RCL 3
067  -
068  3
069  +
070  STO 0
071  7
072  /
073  INT
074  7
075  *
076  RCL 0
077  -
078  RCL 4
079  -
080  2
081  6
082  +
083  x>0?
084  GTO 3
085  6
086  9
087  -
088  LBL 3
089  1
090  %
091  4
092  +
093  RCL 1
094  EEX
095  6
096  /
097  +
098  FIX
099  DSP 6
100  RTN

For the latter version the Easter date is shown in MM.DDYYYY format.
For DD.MMYYYY simply change line 83ff:

Code:
...  ...
083  x>0?
084  GTO 3
085  3
086  0
087  .
088  9
089  9
090  +
091  LBL 3
092  .
093  0
094  4
095  +
096  RCL 1
097  EEX
098  6
099  /
100  +
101  FIX
102  DSP 6
103  RTN

Still fits on a single card track. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
09-14-2016, 10:36 PM (This post was last modified: 09-14-2016 10:37 PM by Dieter.)
Post: #8
RE: (12C Platinum) Day of Easter
(09-13-2016 01:26 AM)Gerson W. Barbosa Wrote:  On my HP-42S program I get

Carnival: Feb-19-1950
  Easter: Apr-09-1950

You can also do this with the 12C program I posted.
For carnival, add –49 DATE at the end.
Or –48 DATE over here (Rosenmontag).
It still fits in 99 lines. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
09-15-2016, 01:15 AM (This post was last modified: 09-15-2016 01:17 AM by Gerson W. Barbosa.)
Post: #9
RE: (12C Platinum) Day of Easter
(09-14-2016 10:36 PM)Dieter Wrote:  
(09-13-2016 01:26 AM)Gerson W. Barbosa Wrote:  On my HP-42S program I get

Carnival: Feb-19-1950
  Easter: Apr-09-1950

You can also do this with the 12C program I posted.
For carnival, add –49 DATE at the end.
Or –48 DATE over here (Rosenmontag).
It still fits in 99 lines. ;-)

Very nice! I will try it when I find my 3-cell 12C.

Unfortunately my HP-42S program gets Easter of 1954 wrong (Apr-25 instead of Apr-18). Hopefully not my fault as this agrees with the original Basic program:

Code:

 1  PRINT "DATA DA PASCOA E CARNAVAL ENTRE 1900 E 2099"
 2  PRINT "FORMULAS DE GAUSS. PROGRAMADO POR R. BOCZKO"
 5  REM  CALCULO DA DATA DA PASCOA (GAUSS)
 10  PRINT : INPUT "PASCOA DE QUE ANO? (0 PARA INTERROMPER) ";AN
 15  IF AN < 1583 GOTO 3010
 20 NU = ANO:DE = 19
 30  GOSUB 1000
 40 A = R
 50 DE = 4: GOSUB 1000
 60 B = R
 70 DE = 7: GOSUB 1000
 80 C = R
 90 NU = 19 * A + 24:DE = 30
 100  GOSUB 1000
 110 D = R
 120 NU = 2 * B + 4 * C + 6 * D + 5
 130 DE = 7: GOSUB 1000
 140 E = R
 150 P = 22 + D + E
 155  PRINT : PRINT AN
 160  IF P <  = 31 THEN  PRINT "DATA DA PASCOA=";P;" DE MARCO":ME = 3: GOTO 2000
 170  IF (D + E - 9) <  = 25 THEN  PRINT "DATA DA PASCOA=";P - 31;" DE ABRIL":ME = 4:P = P - 31: GOTO 2000
 1000 R = NU - ( INT (NU / DE)) * DE
 1010  RETURN 
 2000 B = 0
 2002  IF (AN -  INT (AN / 4) * 4) <  > 0 GOTO 2010
 2004 B = 1
 2010  IF ME = 4 THEN  GOTO 2060
 2030 C = 28 + B + P - 49
 2040  PRINT "CARNAVAL = ";C;" DE FEVEREIRO"
 2050  GOTO 2210
 2060 C = 28 + B + 31 + P - 49
 2070  IF C > 28 + B GOTO 2100
 2080  PRINT "CARNAVAL = ";C;" DE FEVEREIRO"
 2090  GOTO 2210
 2100 C = C - 28 - B
 2200  PRINT "CARNAVAL = ";C;" DE MARCO"
 2210  GOTO 10
 3010  END

This program was published eons ago in a poster on calendars that came with Superinteressante magazine (in Portuguese).

I did the conversion from Basic to RPN so blindly that even the modulus subroutine made into the program instead of the built-in MOD function. Anyway, I was using the HP-42S then only as a replacement after I had sold my HP-28S and before I got my first HP-48 GX.

Gerson.
Find all posts by this user
Quote this message in a reply
09-15-2016, 01:15 PM (This post was last modified: 09-15-2016 05:36 PM by Dieter.)
Post: #10
RE: (12C Platinum) Day of Easter
(09-15-2016 01:15 AM)Gerson W. Barbosa Wrote:  Very nice! I will try it when I find my 3-cell 12C.

You can also implement that algorithm on the 42s.
This avoids the error you got with the program you linked to:

(09-15-2016 01:15 AM)Gerson W. Barbosa Wrote:  Unfortunately my HP-42S program gets Easter of 1954 wrong (Apr-25 instead of Apr-18). Hopefully not my fault as this agrees with the original Basic program:

Yes, the error is "by design" – obviously the calculation gets something wrong.

I tried the BASIC algorithm in another 42s implementation and it gets the same errors. But in a much shorter program and with merely two data registers:

Code:
00 { 123-Byte Prgm }
01>LBL "EASTER"
02 ABS
03 IP
04 STO 00
05 19
06 MOD
07 STO 01
08 RCL 00
09 4
10 MOD
11 STO+ ST X
12 RCL 00
13 7
14 MOD
15 4
16 ×
17 +
18 19
19 RCL× 01
20 24
21 +
22 30
23 MOD
24 STO 01
25 6
26 ×
27 +
28 5
29 +
30 7
31 MOD
32 RCL+ 01
33 22
34 +
35 ENTER
36 ENTER
37 31
38 MOD
39 X=0?
40 X<> ST L
41 "Easter: "
42 9
43 X>=Y?
44 |-" "
45 Rv
46 AIP
47 X<>Y
48 32
49 ÷
50 IP
51 3
52 +
53 +/-
54 AIP
55 RCL 00
56 +/-
57 AIP
58 1E4
59 ÷
60 +
61 100
62 ÷
63 -
64 FIX 06
65 AVIEW
66 END

Edit: replaced program with an updated version, including a bugfix.

OK, this is without the carnival part. ;-) But Free42 features additional calendar functions, so a simple –49 DATE+ at the end will get you the date of carnival.

But once again: there is an error in this algorithm.
The mentioned 29C program seems to work fine. So what about a 42s version?

Dieter
Find all posts by this user
Quote this message in a reply
09-15-2016, 05:35 PM
Post: #11
RE: (12C Platinum) Day of Easter
(09-14-2016 01:20 PM)Dieter Wrote:  
(09-14-2016 04:36 AM)bshoring Wrote:  For what it's worth, I'm posting my program for the HP-38C simulator, RPN-38CX. Since this simulator is limited to 99 steps, I loaded all the constants into registers, even financial registers, and replaced many of the arithmetic operators with RCL arithmetic to save steps.

May I draw your attention to this 95-step program for the 29C? I think it can be ported to other calculators. However, the 38C is a bit tricky since a modulo subroutine is called and the 38C offers no GSB. The program can even be shortened as the linked version calculates all easter dates in the entered year and the following ones. If you don't need this simply omit steps 83...86.
Hint: the "print this article" link retrieves a PDF.

(09-14-2016 04:36 AM)bshoring Wrote:  Program listing: (in program mode, copy and paste the program steps to the display to copy the entire program)

Bob, if you use [​code] and [​/code] tags around your listing it will be properly formatted:

Code:
01 - 21 0        STO 0
02 - 22 71 5     RCL ÷ 5
03 - 24 61       INTGR
04 - 21 1        STO 1
05 - 21 4        STO 4
06 - 31          ENTER
07 - 86 71 0     RCL ÷ .0
08 - 24 61       INTGR
09 - 21 41 4     STO - 4
...

Dieter

Dieter,
Thanks for the link to the 29C program. I got it to work on my 38C emulator just fine. First put it on my 67 emulator, which worked well, then by storing several constants, I got it working on the 38C. I verified that it is 100% accurate in the range 1900-2100. I'm guessing it is accurate for a much wider range.

When I have time to clean it up and make it presentable I'll post it here.
Thanks,
Bob


Regards,
Bob
Find all posts by this user
Quote this message in a reply
09-15-2016, 05:46 PM (This post was last modified: 09-15-2016 05:47 PM by Dieter.)
Post: #12
RE: (12C Platinum) Day of Easter
(09-15-2016 05:35 PM)bshoring Wrote:  Thanks for the link to the 29C program. I got it to work on my 38C emulator just fine. First put it on my 67 emulator, which worked well, then by storing several constants, I got it working on the 38C.

The 12C version I posted should work just as well on the 38C (94 steps, 5 registers).
No storing of constants or other tricks required.

(09-15-2016 05:35 PM)bshoring Wrote:  I verified that it is 100% accurate in the range 1900-2100. I'm guessing it is accurate for a much wider range.

I hope so – at least it comes from a source I think we can trust. ;-)
It claims the original program is correct for any date of the Gregorian calendar until 3999.

Dieter
Find all posts by this user
Quote this message in a reply
09-15-2016, 08:42 PM (This post was last modified: 09-15-2016 08:54 PM by Dieter.)
Post: #13
RE: (12C Platinum) Day of Easter
(09-15-2016 01:15 PM)Dieter Wrote:  OK, this is without the carnival part. ;-)
But once again: there is an error in this algorithm.
The mentioned 29C program seems to work fine. So what about a 42s version?

Here is a 67/97 version with the (at least I think so) correctly working algorithm of the 29C program.
And especially for you, Gerson: it includes the date of carnival Sunday. ;-)

Code:
001  LBL A
002  INT
003  STO 1
004  STO 0
005  1
006  9
007  /
008  INT
009  1
010  9
011  *
012  STO-0
013  RCL 0
014  1
015  1
016  STO*0
017  /
018  STO 2
019  4
020  4
021  STO+0
022  1
023  RCL 1
024  %
025  INT
026  +
027  3
028  2
029  %
030  .
031  2
032  +
033  INT
034  STO+0
035  RDOWN
036  7
037  5
038  %
039  INT
040  STO 3
041  STO-0
042  RCL 0
043  3
044  0
045  /
046  INT
047  3
048  0
049  *
050  STO-0
051  RCL 2
052  RCL 0
053  x>y?
054  GTO 2
055  1
056  +
057  LBL 2
058  STO 4
059  CHS
060  RCL 1
061  .
062  8
063  /
064  INT
065  +
066  RCL 3
067  -
068  3
069  +
070  STO 0
071  7
072  /
073  INT
074  7
075  *
076  RCL 0
077  -
078  RCL 4
079  -
080  5
081  7
082  +
083  STO 4
084  3
085  STO 3
086  RCL 4
087  3
088  1
089  GSB 9
090  STO 2
091  R/S
092  CF 2
093  RCL 1
094  4
095  /
096  FRAC
097  x!=0?
098  GTO 7
099  SF 2
100  RCL 1
101  EEX
102  2
103  /
104  FRAC
105  x!=0?
106  GTO 7
107  LastX
108  4
109  /
110  FRAC
111  x!=0?
112  CF 2
113  LBL 7
114  2
115  STO 3
116  RCL 4
117  4
118  9
119  -
120  0
121  F2?
122  e^x
123  2
124  8
125  +
126  +
127  LastX
128  GSB 9
129  RCL 2
130  X<>Y
131  RTN
132  LBL 9
133  X<>Y
134  x<=y?
135  GTO 8
136  -
137  CHS
138  1
139  STO+3
140  RDOWN
141  LBL 8   ; for M.DY output change the following lines into...
142  RCL 3   ; EEX
143  EEX     ; 2
144  2       ; /
145  /       ; RCL 3
146  +       ; +
147  RCL 1
148  EEX
149  6
150  /
151  +
152  FIX
153  DSP 6
154  RTN

The 49 in line 117/118 is the number of days before Easter for the carnival date. Users in Central Europe may replace this with 48 to get the date of the following Monday. Output is in D.MY format. If you prefer, this can easily be changed to M.DY (see listing).

I have not done much testing with this program, so beware: it may contain any error you can imagine (and even those you can't ;-)). So try it and see what you get.

Example:

1954 [A] => 18.041954
   [R/S] => 28.021954


At the end both dates are stored in X and Y.

Dieter
Find all posts by this user
Quote this message in a reply
09-15-2016, 10:39 PM
Post: #14
RE: (12C Platinum) Day of Easter
Here is the listing and instructions for the 29C Easter date program modified to work on RPN-38 CX, the iPhone simulator for the HP-38C.

Easter DMY

Enter the year
R/S to get Date on which Easter falls.
(Date appears in dd,mmyyyy format). If the user prefers mm.ddyyyy format simply delete program lines 74-80.

Program has been tested valid for years from 1900-2100. May be valid for a much longer period. Tested against table at:
http://tlarsen2.tripod.com/thomaslarsen/...dates.html

This program requires the following constants be loaded in order to work:

Code:
R.0: 19
R.1: 11
R.2: 44
R.3: 32
R.4: 100
R.5: 30
R.6: 26
R.7: 69

This program makes extensive use of RCL arithmetic and loaded constants. Program is based on a program written by E. L. R. Webb for the HP-29 C in 1979. Modified in 2016 for the RPN-38 CX similator by Bob Shoring.

Code:
01 - 24 61        INTGR
02 - 21 0        STO 0
03 - 21 1        STO 1
04 - 86 71 0      RCL ÷ .0
05 - 24 61        INTGR
06 - 86 61 0      RCL × .0
07 - 21 41 0      STO − 0
08 - 22 0        RCL 0
09 - 22 73 1      RCL .1
10 - 21 61 0      STO × 0
11 - 71          ÷
12 - 21 2        STO 2
13 - 22 73 2      RCL .2
14 - 21 51 0      STO + 0
15 - 1            1
16 - 22 1        RCL 1
17 - 23          %
18 - 24 61        INTGR
19 - 51          +
20 - 22 73 3      RCL .3
21 - 23          %
22 - 73          .
23 - 2            2
24 - 51          +
25 - 24 61        INTGR
26 - 21 51 0      STO + 0
27 - 34          CLx
28 - 7            7
29 - 5            5
30 - 23          %
31 - 24 61        INTGR
32 - 21 3        STO 3
33 - 21 41 0      STO − 0
34 - 22 0        RCL 0
35 - 86 71 5      RCL ÷ .5
36 - 24 61        INTGR
37 - 86 61 5      RCL × .5
38 - 21 41 0      STO − 0
39 - 22 0        RCL 0
40 - 22 2        RCL 2
41 - 33          x≷y
42 - 25 5        x≤y
43 - 25 7 87      GTO 87
44 - 22 0        RCL 0
45 - 21 4        STO 4
46 - 32          CHS
47 - 22 1        RCL 1
48 - 73          .
49 - 8            8
50 - 71          ÷
51 - 24 61        INTGR
52 - 51          +
53 - 22 41 3      RCL − 3
54 - 3            3
55 - 51          +
56 - 21 0        STO 0
57 - 7            7
58 - 71          ÷
59 - 25 31        LASTx
60 - 33          x≷y
61 - 24 61        INTGR
62 - 61          ×
63 - 21 41 0      STO − 0
64 - 0            0
65 - 22 0        RCL 0
66 - 32          CHS
67 - 22 41 4      RCL − 4
68 - 86 51 6      RCL + .6
69 - 25 5        x≤y
70 - 86 41 7      RCL − .7
71 - 86 71 4      RCL ÷ .4
72 - 4            4
73 - 51          +
74 - 24 61        INTGR
75 - 25 31        LASTx
76 - 25 61        FRAC
77 - 86 61 4      RCL × .4
78 - 33          x≷y
79 - 86 71 4      RCL ÷ .4
80 - 51          +
81 - 22 1        RCL 1
82 - 25 32        EEX
83 - 6            6
84 - 71          ÷
85 - 51          +
86 - 25 7 00      GTO 00
87 - 1            1
88 - 21 51 0      STO + 0
89 - 25 33        R↓
90 - 25 7 44      GTO 44
91 - 25 7 00      GTO 00


Regards,
Bob
Find all posts by this user
Quote this message in a reply
09-16-2016, 01:51 AM
Post: #15
RE: (12C Platinum) Day of Easter
(09-14-2016 08:40 PM)Dieter Wrote:  Here is a 12C version of this algorithm. It does not require any subroutine calls and takes advantage of the DATE function which allows the code to fit in 94 lines. This way even the date format setting is observed (MM.DDYYYY or DD.MMYYYY). I did not try this on a 38C/E but it looks like this should run on these as well.

Code:
01  INTG
02  STO 1
03  STO 0
04  1
05  9
06  /
07  INTG
08  1
09  9
10  *
11  STO-0
12  RCL 0
13  1
14  1
15  STO*0
16  /
17  STO 2
18  4
19  4
20  STO+0
21  1
22  RCL 1
23  %
24  INTG
25  +
26  3
27  2
28  %
29  .
30  2
31  +
32  INTG
33  STO+0
34  R↓
35  7
36  5
37  %
38  INTG
39  STO 3
40  STO-0
41  RCL 0
42  3
43  0
44  /
45  INTG
46  3
47  0
48  *
49  STO-0
50  RCL 2
51  RCL 0
52  x<=y?
53  GTO 55
54  GTO 57
55  1
56  +
57  STO 4
58  CHS
59  RCL 1
60  .
61  8
62  /
63  INTG
64  +
65  RCL 3
66  -
67  3
68  +
69  STO 0
70  7
71  /
72  INTG
73  7
74  *
75  RCL 0
76  -
77  RCL 4
78  -
79  5
80  4
81  +
82  RCL 1
83  EEX
84  6
85  /
86  3
87  .
88  0
89  3
90  +
91  X<>Y
92  DATE
93  FIX 6
94  GTO 00

It does work on RPN-38 CX:

Easter

By Dieter

01 - 24 61 INTGR
02 - 21 1 STO 1
03 - 21 0 STO 0
04 - 1 1
05 - 9 9
06 - 71 ÷
07 - 24 61 INTGR
08 - 1 1
09 - 9 9
10 - 61 ×
11 - 21 41 0 STO − 0
12 - 22 0 RCL 0
13 - 1 1
14 - 1 1
15 - 21 61 0 STO × 0
16 - 71 ÷
17 - 21 2 STO 2
18 - 4 4
19 - 4 4
20 - 21 51 0 STO + 0
21 - 1 1
22 - 22 1 RCL 1
23 - 23 %
24 - 24 61 INTGR
25 - 51 +
26 - 3 3
27 - 2 2
28 - 23 %
29 - 73 .
30 - 2 2
31 - 51 +
32 - 24 61 INTGR
33 - 21 51 0 STO + 0
34 - 25 33 R↓
35 - 7 7
36 - 5 5
37 - 23 %
38 - 24 61 INTGR
39 - 21 3 STO 3
40 - 21 41 0 STO − 0
41 - 22 0 RCL 0
42 - 3 3
43 - 0 0
44 - 71 ÷
45 - 24 61 INTGR
46 - 3 3
47 - 0 0
48 - 61 ×
49 - 21 41 0 STO − 0
50 - 22 2 RCL 2
51 - 22 0 RCL 0
52 - 25 5 x≤y
53 - 25 7 55 GTO 55
54 - 25 7 57 GTO 57
55 - 1 1
56 - 51 +
57 - 21 4 STO 4
58 - 32 CHS
59 - 22 1 RCL 1
60 - 73 .
61 - 8 8
62 - 71 ÷
63 - 24 61 INTGR
64 - 51 +
65 - 22 41 3 RCL − 3
66 - 3 3
67 - 51 +
68 - 21 0 STO 0
69 - 7 7
70 - 71 ÷
71 - 24 61 INTGR
72 - 7 7
73 - 61 ×
74 - 22 41 0 RCL − 0
75 - 22 41 4 RCL − 4
76 - 5 5
77 - 4 4
78 - 51 +
79 - 22 1 RCL 1
80 - 25 32 EEX
81 - 6 6
82 - 71 ÷
83 - 3 3
84 - 73 .
85 - 0 0
86 - 3 3
87 - 51 +
88 - 33 x≷y
89 - 24 51 DATE
90 - 24 6 FIX 6
91 - 25 7 00 GTO 00

1950 R/S -> 4,09,1950 7 (M.DY) or 9,04,1950 7 (D.MY)

(Out of code box for easier copying and pasting into RPN-38 CX)

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
09-16-2016, 03:00 AM
Post: #16
RE: (12C Platinum) Day of Easter
Thanks Dieter and Gerson. I pasted the listing directly into my RPN-38 CX and it's running like a charm. This is, so far, the most compact program I've seen for getting the date of Easter. Nice thing is, it works in either mm.ddyyyy or did.mmyyyy mode, depending on the setting of the switch.

Regards,
Bob


Regards,
Bob
Find all posts by this user
Quote this message in a reply
09-16-2016, 06:03 AM
Post: #17
RE: (12C Platinum) Day of Easter
(09-16-2016 01:51 AM)Gerson W. Barbosa Wrote:  It does work on RPN-38 CX:

Good to have this confirmed. Thank you.

(09-16-2016 01:51 AM)Gerson W. Barbosa Wrote:  Easter
By Dieter

I did just the transcoding for the 12C/38C. The elegant and very compact algorithm is by E. L. R. Webb as published in his 1979 paper by the Royal Astronomical Society of Canada.

(09-16-2016 01:51 AM)Gerson W. Barbosa Wrote:  (Out of code box for easier copying and pasting into RPN-38 CX)

Copy/Paste is no problem even with code boxes if you use the "View a printable version" link at the bottom of the page.

Dieter
Find all posts by this user
Quote this message in a reply
09-16-2016, 06:14 AM
Post: #18
RE: (12C Platinum) Day of Easter
(09-16-2016 03:00 AM)bshoring Wrote:  Thanks Dieter and Gerson. I pasted the listing directly into my RPN-38 CX and it's running like a charm. This is, so far, the most compact program I've seen for getting the date of Easter. Nice thing is, it works in either mm.ddyyyy or did.mmyyyy mode, depending on the setting of the switch.

That's why it uses the DATE function. ;-) I modified the original 29C program so that it essentially calculates the Easter date as the number of days after the 3rd of March. Which is 3,03yyyy in either date mode.

Dieter
Find all posts by this user
Quote this message in a reply
09-17-2016, 07:12 PM (This post was last modified: 09-17-2016 09:28 PM by Dieter.)
Post: #19
RE: (12C Platinum) Day of Easter
(09-15-2016 01:15 AM)Gerson W. Barbosa Wrote:  Unfortunately my HP-42S program gets Easter of 1954 wrong (Apr-25 instead of Apr-18). Hopefully not my fault as this agrees with the original Basic program:

Gerson, I just happened to find this algorithm via Google books in a Turbo Pascal book by Nell Dale and Chip Weems. There is a remark saying that the program works for years between 1982 and 2048 (!). And within the period from 1900 to 2099 there are four years where the result is one week late: 1954 (sic!), 1981, 2049 and 2076. ;-)

If you still have the magazine article you mentioned, you may look if there is a similar remark with this restriction.

Update: Here is a 42s version of the Easter/Carnival program based on the 29C algorithm.
The method for determining the number of days in February is explained at this 35s program.

Code:
 00 { 216-Byte Prgm }
 01>LBL "EASTER"
 02 ABS
 03 IP
 04 STO 01
 05 19
 06 MOD
 07 STO 00
 08 11
 09 STO× 00
 10 ÷
 11 STO 02
 12 44
 13 STO+ 00
 14 1
 15 RCL 01
 16 %
 17 IP
 18 +
 19 32
 20 %
 21 0.2
 22 +
 23 IP
 24 STO+ 00
 25 Rv
 26 75
 27 %
 28 IP
 29 STO 03
 30 STO- 00
 31 RCL 02
 32 RCL 00
 33 30
 34 MOD
 35 X>Y?
 36 GTO 00
 37 1
 38 +
 39>LBL 00
 40 STO 04
 41 +/-
 42 RCL 01
 43 0.8
 44 ÷
 45 IP
 46 +
 47 RCL 03
 48 -
 49 3
 50 STO 03
 51 +
 52 7
 53 MOD
 54 +/-
 55 RCL 04
 56 -
 57 57
 58 +
 59 STO 04
 60 31
 61 "Easter:   "        ; three blanks after colon
 62 XEQ 01
 63 STO 02
 64 29
 65 RCL 01
 66 4
 67 MOD
 68 X!=0?
 69 SIGN
 70 RCL 01
 71 100
 72 MOD
 73 X!=0?
 74 SIGN
 75 +
 76 RCL 01
 77 400
 78 MOD
 79 X!=0?
 80 SIGN
 81 +
 82 2
 83 STO 03
 84 MOD
 85 -
 86 RCL 04
 87 49                  ; Carnival is 49 days before Easter
 88 -
 89 X<>Y
 90 +
 91 STO 04
 92 LASTX
 93 |-"\LFCarnival: "   ; first character is linefeed
 94 XEQ 01
 95 RCL 02
 96 X<>Y
 97 AVIEW
 98 ADV
 99 RTN
100>LBL 01
101 RCL 04
102 X<=Y?
103 GTO 02
104 X<>Y
105 -
106 ISG 03
107>LBL 02
108 9
109 X<>Y
110 X<=Y?
111 |-" "
112 AIP
113 RCL 03
114 +/-
115 AIP
116 RCL 01
117 +/-
118 AIP
119 1E4
120 ÷
121 +
122 100
123 ÷
124 -
125 END

Example:

1954   XEQ "EASTER"
=>
Easter:   18-4-1954
Carnival: 28-2-1954

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)