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 Pto run program. Prime number, P will be displayed.

4.To see the next prime number, press .

Variables Used:

PPrime value and potential prime values.

DDivisor 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:

(In ALG mode)

 

 

P





Description:

Calculates next prime number after 789.

Calculates next prime number after 797.

17-10Miscellaneous Programs and Equations

Page 280
Image 280
HP 35s Scientific manual  , 17-10Miscellaneous Programs and Equations