10 PRINT "PRIME FACTORS OF INTEGERS"
20 PRINT
30 PRINT "(ENTER 0 TO END PROGRAM)"
40 PRINT "NUMBER";
50 INPUT Z
59 REM - END PROGRAM?
60 IF Z=0 THEN 200
69 REM - THE SIGN OF THE NUMBER IS ALWAYS A FACTOR
70 PRINT SGN(Z)
79 REM - USE ABSOLUTE VALUE FOR CALCULATIONS
80 Z=ABS(Z)
89 REM - LOOP TO TEST ALL INTEGERS (2 THROUGH Z) AS PRIME FACTORS
90 FOR I=2 TO Z
100 S=0
110 IF Z/I<>INT(Z/I) THEN 150
120 Z=Z/I
130 S=S+1
140 GOTO 110
149 REM - FIND A PRIME FACTOR? IF YES, PRINT
150 IF S=0 THEN 170
159 REM - PRINT FACTORS WITH EXPONENTS; I[S = I TO THE S POWER
160 PRINT I;"[";S
170 NEXT I
180 PRINT
189 REM - RESTART PROGRAM
190 GOTO 40
200 END
