The Museum of HP Calculators


Prime Factors for the HP 20s

This program is by Dave Britten and is used here by permission.

This program is supplied without representation or warranty of any kind. Dave Britten and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

Usage:
x (positive integer), XEQ A

The first prime factor will be displayed. Press R/S to display subsequent factors. When 1 is displayed, there are no more factors.

Checksum: 8C41

Listing

01-     LBL A
02-     STO 1
03-     √x
04-     IP
05-     STO 3
06-     2
07-     STO 2
08-     LBL 1
09-     RCL 1
10-     INPUT
11-     =
12-     -
13-     1
14-     =
15-     x=0?
16-     GTO 4
17-     SWAP
18-     ÷
19-     RCL 2
20-     =
21-     INPUT
22-     FP
23-     x=0?
24-     GTO 2
25-     3
26-     INPUT
27-     RCL 2
28-     x≤y?
29-     GTO 3
30-     -
31-     1
32-     LBL 3
33-     +
34-     2
35-     =
36-     STO 2
37-     INPUT
38-     RCL 3
39-     x≤y?
40-     GTO 1
41-     RCL 1
42-     STO 2
43-     GTO 1
44-     LBL 2
45-     SWAP
46-     STO 1
47-     C
48-     RCL 2
49-     R/S
50-     GTO 1
51-     LBL 4
52-     C
53-     1
54-     =
55-     RTN

Go back to the software library
Go back to the main exhibit hall