Post Reply 
Prime number finder HP11C?
06-18-2016, 07:23 PM
Post: #13
RE: Prime number finder HP11C?
I took your original program and modified it to work on an HP-38C. But if you ignore the key codes it should work just fine on a 12C or 11C. Of course on the HP-38C emulator (RPN-38 CX) it is super fast.

This program works two ways:

1. If X contains 0 or a negative number, the program will display all prime numbers until you press R/S. A count is maintained in Y.

2. If X contains a positive integer, the program will return the corresponding prime value. For example:

If X contains 5, the program will return the 5th prime number, which is 11.

Always initialize by pressing g CLP in Run Mode, to reset the program counter.

01 - 0 0
02 - 33 x≷y
03 - 25 5 x≤y
04 - 34 CLx
05 - 21 3 STO 3
06 - 25 6 x=0
07 - 25 7 12 GTO 12
08 - 2 2
09 - 21 0 STO 0
10 - 3 3
11 - 25 7 20 GTO 20
12 - 1 1
13 - 31 ENTER
14 - 2 2
15 - 21 0 STO 0
16 - 25 4 PSE
17 - 31 ENTER
18 - 3 3
19 - 25 4 PSE
20 - 21 1 STO 1
21 - 1 1
22 - 21 2 STO 2
23 - 2 2
24 - 21 51 2 STO + 2
25 - 22 1 RCL 1
26 - 22 2 RCL 2
27 - 71 ÷
28 - 25 61 FRAC
29 - 25 6 x=0
30 - 25 7 48 GTO 48
31 - 25 31 LASTx
32 - 22 2 RCL 2
33 - 25 5 x≤y
34 - 25 7 23 GTO 23
35 - 1 1
36 - 21 51 0 STO + 0
37 - 22 3 RCL 3
38 - 25 6 x=0
39 - 25 7 45 GTO 45
40 - 22 0 RCL 0
41 - 22 3 RCL 3
42 - 25 5 x≤y
43 - 25 7 52 GTO 52
44 - 25 7 48 GTO 48
45 - 22 0 RCL 0
46 - 22 1 RCL 1
47 - 25 4 PSE
48 - 2 2
49 - 22 1 RCL 1
50 - 51 +
51 - 25 7 20 GTO 20
52 - 2 2
53 - 22 3 RCL 3
54 - 25 5 x≤y
55 - 25 7 58 GTO 58
56 - 22 1 RCL 1
57 - 25 7 00 GTO 00
58 - 31 ENTER
59 - 31 ENTER
60 - 1 1
61 - 51 +
62 - 25 7 00 GTO 00


Regards,
Bob
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Prime number finder HP11C? - jbhp55 - 06-13-2016, 07:15 PM
RE: Prime number finder HP11C? - jbhp55 - 06-14-2016, 06:33 AM
RE: Prime number finder HP11C? - TASP - 06-14-2016, 11:35 PM
RE: Prime number finder HP11C? - jbhp55 - 06-16-2016, 07:56 PM
RE: Prime number finder HP11C? - jbhp55 - 06-17-2016, 07:08 AM
RE: Prime number finder HP11C? - Dieter - 06-17-2016, 06:42 PM
RE: Prime number finder HP11C? - Marcio - 06-27-2016, 10:17 PM
RE: Prime number finder HP11C? - jbhp55 - 06-17-2016, 10:43 AM
RE: Prime number finder HP11C? - rprosperi - 06-18-2016, 10:27 PM
RE: Prime number finder HP11C? - bshoring - 06-18-2016 07:23 PM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 01:14 PM
RE: Prime number finder HP11C? - rprosperi - 06-19-2016, 08:03 PM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 01:17 PM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 05:35 PM
RE: Prime number finder HP11C? - rprosperi - 06-19-2016, 07:25 PM
RE: Prime number finder HP11C? - rprosperi - 06-20-2016, 12:05 AM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 09:28 PM
RE: Prime number finder HP11C? - rprosperi - 06-20-2016, 12:20 AM



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