HP Forums

Full Version: (11C) Prime Factor Finder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Program to find Prime Factorization.

This routine is reasonably fast to find prime factor consider
the slow computation speed on original Voyager Series.

Procedure: f [USER] FIX 0

n [E] display first prime factor and continue with [R/S] until
Negative value of n shown indicate that it is done.

Example:

1007 = 19 x 53

1007 [E] display 19 [R/S] 53 [R/S] -1007

------------------------------------------------

18081 = 3 x 3 x 7 x7 x 41

18081 [E] display 3 [R/S] 3 [R/S] 7 [R/S] 7 [R/S] 41 [R/S] -18081

Program: Prime Factor Finder
Code:

LBL E
STO 3
STO 0
1
STO 1
2
STO 2
---------------------------
LBL 5
RCL 0
RCL 2
รท
LSTx
X>Y
GTO 6
X<>Y
INT
LSTx
X=Y
GTO 7
2
STO+1
RCL 1
STO 2
GTO 5
-------------------------------
LBL 7
RCL 2
R/S
Rv
STO 0
GTO 5
--------------------------------
LBL 6
RCL 0
R/S
RCL 3
CHS
RTN

Gamo
Reference URL's