Wednesday, March 22, 2017

HP 15C: Prime Factorization



HP 15C: Prime Factorization

This program does exactly this: factors an integer.  Fix 0 mode is activated during execution.  Each factor is displayed by pressing [R/S].  The calculator is returned to Fix 4 mode when the program is completed.  If the integer is a prime number, the program just returns the integer entered.  

Step
Key
Code
001
LBL B
42, 21, 22
002
FIX 0
42, 7, 0
003
STO 2
44, 2
004
STO 0
44, 0
005
2
2
006
STO 1
44, 1
007
LBL 3
42, 21, 3
008
RCL 0
45, 0
009
RCL÷ 1
45, 10, 1
010
ENTER
36
011
FRAC
42, 44
012
X=0
43, 20
013
GTO 2
22, 2
014
1
1
015
STO+ 1
44, 40, 1
016
GTO 3
22, 3
017
LBL 2
42, 21, 2
018
RCL 1
45, 1
019
R/S
31
020
R↓
33
021
R↓
33
022
STO 0
44, 0
023
1
1
024
-
30
025
X≠0
43, 30, 0  (TEST 0)
026
GTO 3
22, 3
027
LBL 2
45, 2
028
FIX 4
42, 7, 4 
029
RTN
43, 32

Example:  150.  Factors:  2, 3, 5, 5 (when the display reads 150.0000 the factorization ends)

This blog is property of Edward Shore, 2017.

6 comments:

  1. Very useful factorization program for HP 15C I try it on my Samsung S7 Edge with HP 15C App.
    Factorize 111,111,189 = 3*7*41*129,049 when press R/S for the last factorization it took about 7 second to get the last answer very amazing!!! consider the CPU in this smartphone. I try the same with HP Prime APP on computer it gave answer instantly using ifactor(111,111,189)
    This also takes about 5 seconds for 1,177,112

    Thank You for your program and keep the good work!!!

    ReplyDelete
    Replies
    1. Update
      I try Free HP PRIME APP On the S7 EDGE and the speed is lighting fast only HP 15C gave answer slower maybe because of the code build for it classic computation style.

      Delete
    2. HP 15C App on S7 Edge with ifactor(8,771,155) = 5*1,754,231 takes 1 minute and 12 second to compute!!!
      I would like to know how long it take to compute on a real physical HP 15C LE since I don't have one.

      Delete
  2. We will explore the perceived random distribution of Prime Numbers. You can also download materials to know more about prime numbers.

    ReplyDelete
  3. This is awesome, Eddie. I have a 15c app on my android and I'm about to order the Swiss Micros DM15L.

    ReplyDelete

Adventures in Python: String Manipulation and Function/Derivative Table (Subroutines)

Adventures in Python:  String Manipulation and Function/Derivative Table (Subroutines) String Manipulation This script demonstrate...