Primes by Trial Division - Rocky Mountain BASIC
21 March 2020
The Rocky Mountain BASIC version is identical to the IBM PC BASIC / Microsoft GW-BASIC version apart from the use of DISP to display results on the screen (PRINT outputs to an actual printer device), and both COUNT and INDEX being reserved words in this BASIC.
1 GOTO 10 5 c = c + 1 6 GOTO 50 10 DIM primes(99) 20 primes(0) = 2 25 DISP primes(0) 30 c = 3 40 FOR found = 1 TO 99 50 FOR i = 0 TO (found - 1) 60 IF (c MOD primes(i)) = 0 THEN GOTO 5 70 NEXT i 80 DISP c 90 primes(found) = c 100 c = c + 1 110 NEXT found 120 END