Code:
Do not enter semicolons(;) and/or the text that follows semicolons, they are notes for the user(you), that the TI-83 plus can't handle.
All commands, such as ClrHome, Dim, Input, If, Then, End, etc., etc. must be entered by a menu (e.g. MATH, PRGM, TEST).
E.g. is short for exempli gratia.
Exempli gratia is a Latin phrase which may be translated into English as "for the favor of example" or "for the sake of example."
E.g. should not be confused with id est.
Id est is also Latin.
Id est may be translated into English as "it is" or "that is."
The commands will not work if they are entered using the ALPHA state.
L1 and L2 are lists which must be entered by pressing the 2nd key followed by 1 or 2 respectively.
Respectively, in the previous sentence, means that 1 goes to L1 and 2 goes with L2, that they go together in the order presented.
Variables (e.g. Z, N, E, B, M) and String (e.g. "NUM:") may be entered using the ALPHA state and keys with the appropriate green character to their top right.
Matrix [A] must be entered using the matrix menu accessed by using 2nd shift key and the inverse key (5 keys above ON).
The =,≠,> and similar sings may be found in the TEST menu which is accessed by pressing 2nd and MATH (6 keys above ON).
All commands may be found in the CATALOG menu accessed by pressing 2nd and Zero(0) (one key to the right of ON).
PROGRAM:ProgramX ; Type of application: Name of application
:ClrHome
:0→dim(L1) ; set List1 to size 0, id est, clear list one. List1 stores the number of times each of NUM's prime factors goes into NUM.
:0→dim(L2) ; same but for List2. List2 stores the value of each of NUM's unique primes.
:Input "NUMBER= ",Z ; Say "NUM:" to ask the user for a number. Store the number in Z.
:1→N ; Store 1 in N, id est, set N to 1. N is the number of times B divides evenly into NUM. N is the number of NUM's unique primes.
:2→B ; Set B to two(2). Two(2) is the lowest prime number.
:0→E ; Set E to zero(0). E is the number of time B divides evenly into NUM. The exponent of the prime B.
:√(Z)→M ; set M to the square root of Z. M is the highest possible number that can divide Z if Z is not prime.
:While B≤M ; Run the program until B is greater than the square root of Z
:While fPart(Z/B)=0 ; Divide Z by B as long as the division is "even", id est, there is no remainder(fPart is the fraction part which or remainder).
:E+1→E ; Add one to the tally of E every time B divides evenly into Z.
:Z/B→Z ; Every time B divides evenly into Z, store the result as the new Z.
:End ; End of the "While fPart(Z/B)=0" loop
:If E>0 ; If Z was divisible for the current B,
:Then ; Then
:B→L2(N) ; Store the value of B in List 2 at position N
:E→L1(N) ; Store the value of E in List 1 at position N
:N+1→N ; Increase N by 1. The program will look for another prime.
:0→E ; Reset E to 0, because NUM might not be divisible by the next B.
:√(Z)→M ; Set M to the current Z (NUM divided by all the primes discovered up to this point)
:End ; End of "If E>0" Then...
:If B=2 ; If B is two(2)
:Then ; Then
:3→B ; Set B to Three (there are no even primes above 2)
:Else ; Otherwise
:B+2→B ; Set B to the next higher odd number.
:End ; End of "If B=2" Then...Else...
:End ; End of "While B≤M" loop
:If Z≠1 ; If Z is not one (id est, If Z is a prime number)
:Then ; Then
:Z→L2(N) ; Store the value of Z in List2 position N
:1→L1(N) ; Store the value of 1 in List2 position N
:Else ; Otherwise ( If Not Z≠1)
:If Z=1 ; If Z=1 (this is a part of a check to see if NUM was 1
:Then ; Then
:If N=1 ; If Z=1 and N=1, id est, Z was not prime and was not divided by a value greater than 1.
:Then ; Then
:Z→L2(N) ; Store Z in List 2 at position N.
:1→L1(N) ; Store 1 in List1 at position N.
:End ; End of "If Z=1" Then...
:End ; End of "If Z≠1" Then...Else...
:List►matr(L1,L2,[A]) ; Combine List1 and List2 as rows in Matrix [A]
:Pause [A] ; Pause the program and display Matrix [A]
######################################################################################################
License information:
ProgramX is a derivative work (in the artistic rather than mathematical sense) of a program developed
in Austria by a group of students under the guidance of a teacher. The teacher posted the program on
www.mathhelpforum.com under the handle EarBoth at at 2138 GMT on 16 July 2008. EarBoth gave permission
to Søren Kyale to publish ProgramX under a Creative Commons (by-nc-sa) license. Søren Kyale added some
documentation and revisions.
ProgramX was published under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported
Lisence. <http://creativecommons.org/licenses/by-nc-sa/3.0/>
by Søren Kyale <soren.kyale(AT)gmail.com>
on 7 February 2009.