beautypg.com

HP 32SII User Manual

Page 295

background image

Miscellaneous Programs and Equations 17–9

File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm

Program Lines:

Description

%

!

&

If all factors have been tried, branches to the display
routine.

%

Calculates the next possible factor, D + 2.

%

!-

%

!

%

Branches to test potential prime with new factor.

Checksum and length: 061F 021.0

Flags Used:

None.

Memory Required:

61 bytes: 45 for program, 16 for variables.

Program Instructions:

1. Key in the program routines; press

†

when done.

2. Key in a positive integer greater than 3.
3. Press

W

P to run program. Prime number, P will b e displayed.

4. To see the next prime number, press

f

.

Variables Used:

P

Prime value and potential prime values.

D

Divisor used to test the current value of P.

Remarks:

No test is made to ensure that the input is greater than 3.

Example.

What is the first prime number after 789

?

What is the next prime number

?

Keys: Display:

Description: