Prime Factors for TI-73 Explorer ( v1.0 )

  My daughter has a TI-73 for 6'th grade math applications, especially for operations involving fractions. As it's taught, concepts such as the LCM (least common multiple) and GCD or GCF (greatest common factor) are used in order to reduce or set fractions to common denominators. This often involves also determining the prime factors.
  The TI-73 does not have a factoring function so I've written a program (in TI-73 Basic) to perform that operation.
  There are limitations. The programming on the TI-73 is adequate but understandably not lightning fast - we won't be doing any factoring or prime determination for RSA applications, so... integer inputs to the factoring program are limited to one million (1,000,000). This was done both for time consideration and room on the screen to list the maximum possible number of prime factors for integers in this range. As it is, it takes the TI-73 about 25 seconds to determine that a prime number, just under one million, has no factors. Besides, I don't think sixth graders will be working with fractions involving integers anywhere near this size!
  For those of you interested in the algorithm used in this program, I've included the source code in text format below. The program is longer than it could be due to formatting of the output to match, as closely as possible, the prime factor list format given in standard texts used in the schools. Source code is followed by an explanation of the program variable assignments. Below the variable assignments is a couple screen shots ( simple formatted text ) to give you an idea of what the screen input and output looks like.
  Enjoy! Any questions, you can reach me at jtcullen AT lrbcg DOT com

JT

*******************************************************
Source Code for Prime Factors for TI-73 Explorer v1.0 *
                                                      *
Note:  => symbol means STO to variable                *
       Sqrt is the 'Square Root' function             *
       /= means 'is not equal to'                     *
       <= means 'is less than or equal to'            *
*******************************************************

Input "NUMBER =",M
iPart(Abs(M)) => N
if M>1000000 or M<2 : Then
Disp "INVALID"
Pause : Return
End

ClrScreen
Output(1,1,M)
Output(1,9,"=")

0 => Z : 2 =>R
iPart(Sqrt(N)) => L
2 => P : 0 => C

While Remainder(N,2)=0
N/2 => N : C+1 => C
End

If C /= 0 : Then
1 => Z : R+1 => R
iPart(Sqrt(N)) => L
Output(2,1,P)
If C>1 : Then
Output(2,2,"^")
Output(2,3,C)
End : End

3 => P
While P <= L and N>1
0 => C
While Remainder(N,P)=0
N/P => N : C+1 => C
End

If C /= 0 : Then
1 => Z : iPart(Sqrt(N)) => L
2+iPart(log(P)) => V
Output(R,1,P)
If C>1 : Then
Output(R,V,"^")
Output(R,V+1,C)
End : R+1 => R
End : P+2 => P
End

If Z=0 : Then
Output(2,1,"A PRIME NUMBER!")
Pause : Return : End

If N>1 : Then
Output(R,1,N) : End

Output(8,13,"DONE")
Pause : Return


*******************************************************
Variable Assignments:

M = Original Input to Prime Factor program
N = Positive Integer limited to > 2 and < 1,000,000
Z = Factors found? 1=Yes, 0=No
C = Exponent for a given Prime Factor
R = Current Row number for screen printing (1 thru 8)
L = Current limiting value for prime factor searches
P = Current odd integer as prime factor candidate
V = Number of decimal digits plus one in prime factor
*******************************************************


Screen Shots

****************
prgmFACTOR     *
               *
               *
               *
               *
               *
               *
               *
****************

****************
NUMBER= 123456 *
               *
               *
               *
               *
               *
               *
               *
****************

****************
123456  =      *
2^6            *
3              *
643            *
               *
               *
               *
           DONE*
****************

****************
456456  =      *
2^3            *
3              *
7              *
11             *
13             *
19             *
           DONE*
****************

****************
999997  =      *
757            *   This output
1321           *   takes about
               *   20-25 seconds
               *   to calculate.
               *
               *
           DONE*
****************

****************
999983  =      *
A PRIME NUMBER!*   It takes about
               *   25 seconds for
               *   the program to
               *   determine that
               *   999983 has no
               *   factors.
               *
****************