Miscellaneous Programs and Equations
17–9
File name 33s-E-Manual-1008-Publication(1st).doc Page : 386
Printed Date : 2003/10/8 Size : 13.7 x 21.2 cm
Program Lines:
(In RPN mode)
Description
routine.
Calculates the next possible factor, D + 2.
Branches to test potential prime with new factor.
Checksum and length: 51D2 54
Flags Used:
None.
Program Instructions:
1. Key in the program routines; press
Å
when done.
2. Key in a positive integer greater than 3.
3. Press
t
P to run program. Prime number, P will be displayed.
4. To see the next prime number, press
¥
.
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:
(In RPN mode)
Display: Description:
789
t
P
Calculates next prime number
after 789.
¥
Calculates next prime number
after 797.