10 REM reprinted from TIMELINEZ July/Aug'87
90 REM fast prime number generator (max=approx 7621)
100 REM by Fred Templeton
110 INPUT "find primes to: ";n
120 IF n<2 THEN PRINT "must be greater than 1": GO TO 110
130 CLS : DIM m(n)
140 PRINT "prime numbers from 2 to ";n;":";" ";2
150 FOR c=3 TO n STEP 2
160 IF m(c) THEN GO TO 210
170 PRINT " ";c;
180 FOR l=c*3 TO n STEP 2*c
190 LET m(1)=1
200 NEXT l
210 NEXT c
220 GO TO 100
9999 CLEAR : SAVE "primes"
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.