' ' Program to determine PRIME numbers ' up to 32765 (3512 in total) ' ' Written by: Peter King ' ' Website: www.procontechnology.com.au ' ' See if you can change this program ' to work out all prime numbers up to ' 1,000,000,000. Print these out to a ' file - this will take some time! ' DEFINT A-Z DIM p(0 TO 3512) p(1) = 2 p(2) = 3 i = 2 CLS t1! = TIMER FOR j = 5 TO 32765 STEP 2 k = -1 l = 2 n = SQR(j) DO m = p(l) IF j MOD m THEN ELSE k = 0: EXIT DO l = l + 1 LOOP UNTIL m >= n IF k THEN i = i + 1 p(i) = j END IF NEXT j t2! = TIMER FOR j = 1 TO i PRINT p(j); NEXT j PRINT PRINT PRINT "TOTAL PRIMES:"; i, "TIME TAKEN:"; t2! - t1!