mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-12 10:07:00 +00:00
17 lines
367 B
QBasic
17 lines
367 B
QBasic
|
005 OPTION CPUSPEED MAX
|
||
|
010 REM***A PRIME NUMBER SIEVE BENCHMARK
|
||
|
020 T = TIMER
|
||
|
025 N = 8191
|
||
|
030 DIM F(N+3)
|
||
|
040 FOR I = 0 TO N : F(I) = 1 : NEXT I
|
||
|
050 S = N
|
||
|
060 FOR I = 0 TO S
|
||
|
070 IF F(I) = 0 THEN GOTO 110
|
||
|
080 P = I+I+3
|
||
|
090 FOR K = I+P TO S STEP P : F(K) = 0 : NEXT K
|
||
|
100 C = C+1
|
||
|
110 NEXT I
|
||
|
120 T = TIMER-T
|
||
|
130 PRINT C;" PRIMES FOUND IN ";T;" SECONDS"
|
||
|
150 END
|