It is based on an program that i made to factor an number. This program finds the first 100,000 in less than 1-2 sec. Very simple code but it work. Is there another way of finding very large prime numbers. Ones with 1000 digits or more in DBC?
set display mode 640,480,16
SET EMULATION on : sync rate 0 : sync on : hide mouse
SET TEXT FONT "Courier New" : SET TEXT SIZE 16
cls 0
Number_COUTNING = 1
Number_Range = 1000000
MAX_Number = (Number_COUTNING + Number_Range)
File_name$ = "Prime " + str$( Number_COUTNING ) + " to " + str$( MAX_Number ) + ".txt"
IF file exist( File_name$ ) = 1 then delete file File_name$
open to Write 1 , File_name$
Display_TIME = TIMER()
PERSEC = 0
start:
IF Number_COUTNING = MAX_Number then cls 0 : sync : end
IF TIMER() >= Display_TIME + 1000
Display_TIME = TIMER()
cls 0
center text screen width() / 2 , 20 , "Prime number finder"
center text screen width() / 2 , 40 , "by Joseph Allen ( ALIEN )"
text 100 , 100 , "Current number: " + str$( Number_COUTNING )
text 100 , 120 , "Per SEC: " + str$( PERSEC )
To_do = MAX_Number - Number_COUTNING
text 100 , 140 , "To do: " + str$( To_do )
text 100 , 160 , "Time left: " + str$( int( To_do / PERSEC ) ) + " sec"
PERSEC = 0
sync
endif
FOR N = 2 to int( SQRT( Number_COUTNING ) ) + 1
IF ( Number_COUTNING / N ) * N = Number_COUTNING then goto exit_Loop
NEXT N
write String 1 , str$( Number_COUTNING )
exit_Loop:
Number_COUTNING = Number_COUTNING + 1
PERSEC = PERSEC + 1
goto start
In the attachment is the code also two other files.