Prime number generator – HP 32SII User Manual

Page 292

Advertising
background image

17–6 Miscellaneous Programs and Equations

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

Note that the interest rate, I, from part 2 is not zero, so you won't get a

#

&

error when you calculate the new I.

Keys: Display:

Description:

{

G

Rº º1.1-

Displays leftmost part of the TVM
equation.

{

œ

F

R@. ) 

Selects F; prompts for P.

f

@ ) 

Retains P; prompts for I.

f

@ ) 

Retains 0.56 in I; prompts for N.

24

f

@8  ) 

Stores 24 in N; prompts for B.

f

#

/.8  ) 

Retains 5750 in B; calculates F, the
future balance. Again, the sign is
negative, indicating that you must,
pay out this money.

z

ž

{

%

} 4



Sets FIX 4 display format.

Prime Number Generator

This program accepts any positive integer greater than 3. If the number is a
prime number (not evenly divisible by integers other than itself and 1), then
the program returns the input value. If the input is not a prime number, then
the program returns the first prime number larger than the input.

The program identifies non–prime numbers by exhaustively trying all possible
factors. If a number is riot prime, the program adds 2 (assuring that the value
is still odd) and tests to see if it, has found a prime. This process continues until
a prime number is found.

Advertising