Prime Factorization - Eddie Shore

Description

N GSB B for prime factors of N

This program factors an integer N. 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.

Example:
150 GSB B.
Factors, displayed with R/S, are 2, 3, 5, 5 (when the display reads 150.0000 the factorization ends)

Program Resources

Labels

Name Description
 B N GSB B for prime factors of N
 2 #
 3 #

Storage Registers

Name Description
 0
 1
 2

Program

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