HP-85 – Osterberechnungen

Das erste Programm berechnet das Osterdatum für ein beliebiges Jahr > 1582. Es benutzt die Gaußsche Osterformel.

100 !------------------------
105 ! Easter Date on HP-85
110 ! for Year > 1582
115 !------------------------
120 !
200 DISP "Year";
205 INPUT Y
210 IF Y<1583 THEN 200
215 GOSUB 500
220 GOSUB 600
225 DISP E$
230 GOTO 200
499 !
500 A=Y MOD 19
505 B=Y MOD 4
510 C=Y MOD 7
515 K=Y DIV 100
520 P=(8*K+13) DIV 25
525 Q=K DIV 4
530 M=(15+K-P-Q) MOD 30
535 D=(19*A+M) MOD 30
540 N=(4+K-Q) MOD 7
545 E=(2*B+4*C+6*D+N) MOD 7
550 O=22+D+E
554 ! 1st exception
555 IF O=57 THEN O=50
559 ! 2nd exception
560 IF O=56 AND D=28 AND E=6 AND A>10 THEN O=49
565 RETURN
599 !
600 IF O>31 THEN 615
605 E$="Mar "&VAL$(O)
610 GOTO 620
615 E$="Apr "&VAL$(O-31)
620 E$=E$&", "&VAL$(Y)
625 RETURN
998 !
999 END

Das zweite Programm zeichnet die Häufigkeitsverteilung der Osterdaten.

100 ! ------------------------
105 ! HP-85 
110 ! Relative frequency of
115 ! Easter dates
120 ! ------------------------
125 !
200 INTEGER C(35)
205 REAL F(35)
209 !
210 FOR I=1 TO 35
215 C(I)=0
220 NEXT I
225 FOR Y=1583 TO 8000
230 GOSUB 500
235 I=O-21
240 C(I)=C(I)+1
245 NEXT Y
298 !
299 ! Compute relative frequencies
300 N=8000-1583+1
305 FOR I=1 TO 35
310 F(I)=35*C(I)/N
315 NEXT I
348 !
349 ! Draw chart
350 GCLEAR
355 SCALE -5,37,-.25,2
360 XAXIS 0,0,0,36
365 YAXIS 0,.5,0,1.5
370 MOVE 6,1.8
375 LABEL "Relative Frequencies"
380 MOVE 9,1.6
385 LABEL "of Easter Dates"
390 MOVE 1,-.2
395 LABEL "Mar 22"
400 MOVE 28,-.2
405 LABEL "Apr 25"
410 MOVE -4.5,.5 @ LABEL "0.5"
415 MOVE -4.5,1 @ LABEL "1.0"
420 MOVE -4.5,1.5 @ LABEL "1.5"
425 FOR I=1 TO 35
430 MOVE I,0
435 DRAW I,F(I)
440 NEXT I
445 FOR I=1 TO 34
450 MOVE I+.4,1
455 DRAW I+.6,1
460 NEXT I
465 GOTO 999
499 !
500 A=Y MOD 19
505 B=Y MOD 4
510 C=Y MOD 7
515 K=Y DIV 100
520 P=(8*K+13) DIV 25
525 Q=K DIV 4
530 M=(15+K-P-Q) MOD 30
535 D=(19*A+M) MOD 30
540 N=(4+K-Q) MOD 7
545 E=(2*B+4*C+6*D+N) MOD 7
550 O=22+D+E
554 ! 1st exception
555 IF O=57 THEN O=50
559 ! 2nd exception
560 IF O=56 AND D=28 AND E=6 AND A>10 THEN O=49
565 RETURN
599 !
600 IF O>31 THEN 615
605 E$="Mar "&VAL$(O)
610 GOTO 620
615 E$="Apr "&VAL$(O-31)
620 E$=E$&", "&VAL$(Y)
625 RETURN
998 !
999 END

Das dritte Programm berechnet für ein beliebiges Startjahr (wieder > 1582), wann Ostern das nächste Mal auf ein bestimmtes Datum fällt.

100 ! ------------------------
105 ! HP-85 
110 ! Next Easter for all
115 ! possible dates
120 ! ------------------------
125 !
130 INTEGER X(35)
199 !
200 DISP "Start year";
205 INPUT S
210 IF S<1583 THEN 200
215 FOR I=1 TO 35
220 X(I)=0
225 NEXT I
230 J=35 @ Y=S
235 GOSUB 500
240 I=O-21
245 IF X(I) > 0 THEN 260
250 X(I)=Y @ J=J-1
255 IF J < 1 THEN 300
260 Y=Y+1
265 GOTO 235
299 !
300 FOR I=1 TO 35
305 O=I+21 @ Y=X(I)
310 GOSUB 600
315 PRINT E$
320 NEXT I
325 GOTO 999
499 !
500 A=Y MOD 19
505 B=Y MOD 4
510 C=Y MOD 7
515 K=Y DIV 100
520 P=(8*K+13) DIV 25
525 Q=K DIV 4
530 M=(15+K-P-Q) MOD 30
535 D=(19*A+M) MOD 30
540 N=(4+K-Q) MOD 7
545 E=(2*B+4*C+6*D+N) MOD 7
550 O=22+D+E
554 ! 1st exception
555 IF O=57 THEN O=50
559 ! 2nd exception
560 IF O=56 AND D=28 AND E=6 AND A>10 THEN O=49
565 RETURN
599 !
600 IF O>31 THEN 615
605 E$="Mar "&VAL$(O)
610 GOTO 635
615 IF O-31<10 THEN 630
620 E$="Apr "&VAL$(O-31)
625 GOTO 635
630 E$="Apr  "&VAL$(O-31)
635 E$=E$&", "&VAL$(Y)
640 RETURN
998 !
999 END