2020-08-13 17:51:35 +00:00
|
|
|
001 OPTION DIALECT MODERN
|
|
|
|
002 OPTION CPUSPEED MAX
|
2020-08-10 03:19:27 +00:00
|
|
|
010 REM***A PRIME NUMBER SIEVE BENCHMARK
|
|
|
|
020 T = TIMER
|
2020-08-13 17:51:35 +00:00
|
|
|
022 C = 0
|
2020-08-10 03:19:27 +00:00
|
|
|
025 N = 8191
|
2020-08-10 16:08:43 +00:00
|
|
|
030 DIM F(N+1)
|
|
|
|
040 FOR I = 0 TO N : F(I)=1 : NEXT I
|
2020-08-10 03:19:27 +00:00
|
|
|
050 S = N
|
|
|
|
060 FOR I = 0 TO S
|
2020-08-10 16:08:43 +00:00
|
|
|
070 IF F(I)=0 THEN GOTO 110
|
2020-08-10 03:19:27 +00:00
|
|
|
080 P = I+I+3
|
2020-08-10 16:08:43 +00:00
|
|
|
085 IF I+P>S THEN GOTO 110
|
|
|
|
090 FOR K=I+P TO S STEP P : F(K)=0 : NEXT K
|
2020-08-10 03:19:27 +00:00
|
|
|
100 C = C+1
|
|
|
|
110 NEXT I
|
|
|
|
120 T = TIMER-T
|
|
|
|
130 PRINT C;" PRIMES FOUND IN ";T;" SECONDS"
|
|
|
|
150 END
|