The Museum of HP Calculators

Primes 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        2 2
A-002       24 ÷ Select 1st odd no.
A-003    61  1 f INT ≥ input
A-004        2 2
A-005       39 ×
A-006        1 1
A-007       59 +
A-008    35  0 STO 0
A-009 61 63  8 f LBL 8
A-010        3 3
A-011    35  1 STO 1
A-012 61 63  9 f LBL 9
A-013    45  0 RCL 0
A-014    45  1 RCL 1 If divisor d > n/d, then
A-015       24 ÷ d > √n; exit.
A-016    61  0 f LAST x
A-017    61 44 f x>y
A-018    63  0 GTO 0
A-019       11 x⇔y
A-020    61  1 f INT If d/n, n is not prime; select
A-021    61  0 f LAST x new n.
A-022    61 41 f x=y
A-023    63  1 GTO 1
A-024        2 2
A-025 35 59  1 STO + 1 Else d ← d + 2; test new d.
A-026    63  9 GTO 9
A-027 61 63  0 f LBL 0
A-028    45  0 RCL 0
A-029       14 PRINT x n is prime; print.
A-030 61 63  1 f LBL 1
A-031        2 2
A-032 35 59  0 STO + 0 Select next n.
A-033    63  8 GTO 8

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