TI
PPC
NOTES
V9N6P5
Modulo 210 Speedy Factor Finder in BASIC (cont)
The program for the Model 100 is reproduced
below.
Laurance wrote
an even faster factor finder program which did not recall the
increments from an array, but rather used in-line techniques such
as those used in the faster TI-59 programs. That program will
declare 9999999967 to be prime in only 15 minutes 11 seconds. If
you
would
like
a copy of
that
program
send
a
SASE.
Finally,
a
reduced
copy
of
the
CC-^0
program
is
presented
below
to
obtain
a
comparison
of
legibility.
CC-40
users
are
invited
to
comment.
Model
100
Program
.
CC-40
Program
100
DIM
RC12),
S<12),
E<53)
110
DATA
2,3,5,7,11,2,4,2,4,6,2,6,4,2,4,6,6,2,6
,4,6,2,4,6,2,6,6,4,2,4,6,2,6,4,2,4,2,10,2,10
,4,2,6,4,6,8,4,2,4,2,4,8,6
120
FOR
I = 1
TO
53:READ
E(I):NEXT
I
130
PRINT"FACTORS,
N=14
DIGITS,MODULO
210
PGM"
200
PRINT:
INPUT"N=*";N
205
T1S=TIMES
210
PRINT
"BUSY
FACTORING"
220
FOR
I = 1
TO
5
230
D =
ECI)
240
IF
INTCN/D)*D=N
THEN
GOSUB
700
250
NEXT
I
300
IF
N/D<=SQRCN)
THEN
RCK)=N:SCJ)=1:GOTO
750
310
FOR
I = 6
TO
53
320
D - D *
EC
I)
330
IF
INTCN/D)»D=N
THEN
GOSUB
700
340
NEXT
I
350
GOTO
300
700
rck)=d:s=s«-i:n=n/d
710
IF
N=l
THEN
RCK)=D:SCJ)=S:GOTO
750
730
IF
INTCN/D)*D=N
THEN
700
740
SCJ)=S:K=K+l:J=J+i:S=o:RETURN
750
T2S=TIMES
800
H=0
810
IF
RCH)
= 0
THEN
900
820
PRINT
RCH)CHRSC94)SCH>,
830
IF
RCH+1)
- 0
THEN
900
840
PRINT
TABC19)RCH+1)CHRSC94)SCH+1)
850
H=H+2:G0T0
810
900
PRINT:PRINT
T2S:PRINT
T1S
910
END
198
DIH
XU23,TCt23,EC533
118
D*T*
2,3,5,7,11,2,4,2,4,8,2,8,*,
2,4,8,6,2,8,4,2,8,4,8,8
120
QfiTfi
4,2,4,2,4,a,e,4,8,2,4,8,2,8
,8,4,2,4,8,2,8,4,2,4,2,18,2,19
L39
FOR
I-l
TO
53:RE*D
ECI3:NEXT
I
149
PRINT
"lodulo
219
Factor*
Prosra
•«:PfHJSE
2
298
INPUT
ttN »
»;*:N9-N
218
PRINT
»Bosy
Factoringu
229
FOR
I-!
TO 5
238
D^ecn
248
IF
INTCN^03tOsN
THEN
GOSUB
499
258
NEXT
I
388IFN'0<»SQRCN3THEN
XCK3-N:TCJ>1
:60T0
588
318
FOR
1-8
TO
53
328
D-D+ECI3
338
IF
INTCN'OJXQsN
THEN
GOSUB
488
348
NEXT
I
358
GOTO
388
488
XOO-OiS-StUNoN/O
418IFN«t
THEN XCK3=»0t
TCJ
3»S:
GOTO 5
88
428
IF INTCN-'OJXOsN TYi&i
488
438
TCJ3»S:<»K+t:J»J+t:S-8:RETURN
588
DISPLAY
BEEP:FOR
1-8
TO 12
518IFXCI3-8
THEN
888
528
PRINT
"cC"*STR*CI+t3a.«0 =»*STR«C
XCI33t»~»a>STRtCTCI33
538
PfHISEJNEXT
I
688
PRINT
»Hu«
«•?
818
PRINT
USINS*•##«##•#••##•#",N8:P
f*JSE
828
FOR
1-8 TO 12:XC13-8:TCI3-8:NEXT
I i
S**
638
J-8:«=8:G0T0
288
PRIME
FACTOR
PRINTOUTS
WITH
THE
CC-40
AND
HX-1000
PRINTER
The
CC-40/HX-1000
-combination
provides a printout capability
on
demand.
Use
of
the
Call
SETLANG
command
before
enter
ing the prime factors program
even provides the annotation
for the printout in the chosen
language. See the examples
at the right.
FftCTEURS
PREHIERS
PRIM8AHLEN
.
Nb a
Decomposer*
387054321
3aM=
387854321
Fl»3
Ft*3
F2«3
F2»3
F3-17
F3»17
F4-17
F4»17
F5-379721
F5«379721