mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-12 10:07:00 +00:00
20 lines
416 B
QBasic
20 lines
416 B
QBasic
OPTION DIALECT MODERN
|
|
OPTION CPUSPEED MAX
|
|
010 REM***A PRIME NUMBER SIEVE BENCHMARK
|
|
020 T = TIMER
|
|
022 C = 0
|
|
025 N = 8191
|
|
030 DIM F(N+1)
|
|
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
|
|
085 IF I+P>S THEN GOTO 110
|
|
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
|