The Museum of HP Calculators

Factors for the HP-95C

This program is Copyright © 1977 by Hewlett-Packard Company and is used here by permission. It was originally printed in the HP-95C Applications book. This program was entered by André Wilhelmus and the curator added comments from the HP manual.

This program is supplied without representation or warranty of any kind. André Wilhelmus, Hewlett-Packard 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.

Program Listing

CODE KEYS
A-000    lbl A f LBL A
A-001    35  0 STO 0 n is no. to be factored.
A-002        1 1
A-003    35  1 STO 1
A-004        2 2
A-005    35  2 STO 2 d in R2 is trial divisor.
A-006 61 63  7 f LBL 7
A-007    45  0 RCL 0
A-008    45  2 RCL 2
A-009       24 ÷
A-010    61  0 f LAST x
A-011    61 44 f x>y If d > n/d, then
A-012    63  0 GTO 0     d > √n; n prime.
A-013       11 x⇔y
A-014    61  1 f INT
A-015    61  0 f LAST x If n/d integer,
A-016    61 41 f x=y     d is a factor; print.
A-017    63  1 GTO 1
A-018        2 2
A-019 35 59  1 STO + 1 Otherwise select next d.
A-020    45  1 RCL 1
A-021    35  2 STO 2
A-022    63  7 GTO 7
A-023 61 63  0 f LBL 0
A-024    45  0 RCL 0 n is prime; print as factor.
A-025       14 PRINT x
A-026    61 53 f RTN
A-027 61 63  1 f LBL 1
A-028    45  2 RCL 2 d is a factor.
A-029       14 PRINT x
A-030       12 R↓ n ← n/d.
A-031    35  0 STO 0
A-032    63  7 GTO 7

Go back to the HP-95C software library
Go back to the general software library
Go back to the main exhibit hall