I know its not faster than c++ or anything, but this one can reach up to 8000 new primes in 20 seconds
It will NOT sync automaticly, to see anything, press space (the program will wait&sync until you release the spacekey)
Have phun:
14 lino:
sync on : sync rate 0 : cls : text 5,5,"Prime finder <*> By Emperor-Baal" : text 5,20,"Press any key to start" : suspend for key
cls : dim prime_list(9000000) : highest_prime = 1 : number = 2 : prime_list(1) = 2
do : ink 0,0 : box 105,0,300,200 : ink rgb(255,255,255),0 : inc number : prime = 1 : buffer$ = str$(number)
select val(mid$(buffer$,len(buffer$)))
case 2 : prime = 0 : endcase
case 4 : prime = 0 : endcase
case 5 : prime = 0 : endcase
case 8 : prime = 0 : endcase
case 0 : prime = 0 : endcase
endselect
if prime = 1 : go# = int( sqrt(number) ) : buffer = 1 : while prime_list(buffer) < go# : inc buffer : endwhile : for a=1 to buffer : if number MOD (prime_list(a)) = 0 : prime = 0 : a = buffer + 1 : endif : next a : endif
if prime = 1 then print number : inc highest_prime : prime_list(highest_prime) = number : text 105,5,"Primes found: "+str$(highest_prime)
while spacekey()=1 : sync : endwhile
loop