![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/6/b4/6b482c5b-16fa-417a-8e80-220f80b9ed92/6b482c5b-16fa-417a-8e80-220f80b9ed92-bg123.png)
Miscellaneous Programs and Equations 17–9
Program Lines:
(In ALG mode)
Description
%
% º
>
¸@
Tests to see whether all possible factors have been tried.
% ! &
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: 161E 57
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
X
P to run program. Prime number, P will be displayed.
4. To see the next prime number, press
g
.
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
?