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.
Very useful factorization program for HP 15C I try it on my Samsung S7 Edge with HP 15C App.
ReplyDeleteFactorize 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!!!
Update
DeleteI 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.
HP 15C App on S7 Edge with ifactor(8,771,155) = 5*1,754,231 takes 1 minute and 12 second to compute!!!
DeleteI would like to know how long it take to compute on a real physical HP 15C LE since I don't have one.
It nice ! Thank for sharing .
ReplyDeleteโกลเด้นสล็อต
goldenslot
We will explore the perceived random distribution of Prime Numbers. You can also download materials to know more about prime numbers.
ReplyDeleteThis is awesome, Eddie. I have a 15c app on my android and I'm about to order the Swiss Micros DM15L.
ReplyDeleteHi,
ReplyDeleteThe programm can be improved by :
Adding 2 instead of 1 after decomposing the prime number 2 (2x faster)
Stopping just after sqrt(start_number) and not going up to star_number (2x faster which make 4x)
Thanks Eddie!
ReplyDeleteThere seems to be an error in your program listing. Line 027 reads "LBL 2" although the keystrokes 45, 2 indicate "RCL 2". The latter would be the correct keys, right?