Primes by Trial Division - TRS-80 Level I BASIC
18 August 2016
Functionally, the TRS-80 Level I BASIC version is identical to the Applesoft reference version. Syntactically, it needed rewriting for the single-character variable names and single array A(). The abbreviation of PRINT as P. wasn't necessary, but was once common practice to save a few bytes of memory. With 4KB, a little here and a little there adds up.
1 GOTO 20 5 C=C+1 10 GOTO 50 20 A(0)=2 25 P. A(0) 30 C=3 40 FOR F=1 TO 99 50 FOR I=0 TO (F-1) 60 V=C/A(I) 65 IF V=INT(V) GOTO 5 70 NEXT I 80 P. C 90 A(F)=C 100 C=C+1 110 NEXT F 120 END