Post Reply 
(29C) Prime numbers up to 10'000
12-20-2018, 06:08 AM
Post: #20
RE: (29C) Prime numbers up to 10'000
Meanwhile C.Ret adapted the program for the HP-41C:
[Image: file.php?id=842]

Here's the same program for the HP-42S:
Code:
00 { 188-Byte Prgm }
01▸LBL "VPRIMS"
02 CLRG
03 FIX 00
04 CF 29
05 STO 25
06 7
07 STO 24
08 "2 3 5"
09 3
10 STO 23
11 XEQ 08
12▸LBL 01
13 XEQ 02
14 XEQ 02
15 4
16 XEQ 04
17 6
18 XEQ 04
19 XEQ 03
20 6
21 XEQ 04
22 GTO 01
23▸LBL 02
24 4
25 XEQ 04
26▸LBL 03
27 2
28▸LBL 04
29 STO+ 24
30▸LBL 05
31 RCL 25
32 RCL 24
33 RCL 01
34 IP
35 X=Y?
36 RTN
37 X>Y?
38 GTO 08
39 LASTX
40 FP
41 200
42 ×
43 STO+ 01
44 1
45 STO ST L
46 RCL 01
47▸LBL 06
48 RCL ST L
49 STO+ ST L
50 X<>Y
51 RCL 00
52 LASTX
53 -
54 X<0?
55 GTO 05
56 RCL IND ST L
57 X<>Y
58 X≠0?
59 ISG ST L
60 GTO 07
61 R↓
62 RCL IND ST L
63 X>Y?
64 DSE ST L
65 X≤Y?
66 X<>Y
67▸LBL 07
68 R↓
69 X>Y?
70 GTO 05
71 STO IND ST Z
72 X<>Y
73 STO IND ST L
74 GTO 06
75▸LBL 08
76 R↓
77 X≤Y?
78 ISG 23
79 GTO 00
80 RCL 23
81 5
82 MOD
83 X≠0?
84 GTO 09
85 PRA
86 CLA
87▸LBL 09
88 X≠0?
89 ├" "
90 ARCL ST Y
91 R↓
92 X↑2
93 X≤Y?
94 ISG 00
95 RTN
96 LASTX
97 1/X
98 %
99 +
100 STO IND 00
101 RTN
102▸LBL 00
103 PRA
104 VIEW 23
105 ADV
106 FIX 04
107 SF 29
108 STOP
109 END

And this is the print-out after running:

1E4 XEQ "VPRIMS"

[Image: attachment.php?aid=6679]

Cheers
Thomas


PS: Instead of ARCL here:
Code:
90 ARCL ST Y
91 R↓

We could use AIP:
Code:
88 R↓
89 AIP

And thus get rid of these lines:
Code:
03 FIX 00
04 CF 29

106 FIX 04
107 SF 29


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (29C) Prime numbers up to 10'000 - Thomas Klemm - 12-20-2018 06:08 AM



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