|
|
DataMuseum.dkPresents historical artifacts from the history of: Jet Computer Jet80 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Jet Computer Jet80 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1152 (0x480)
Types: TextFile
Names: »SIEVE.PAS«
└─⟦692ac107c⟧ Bits:30005923 PolyPascal-80 V3.10 arbejdsdiskette 1
└─⟦this⟧ »SIEVE.PAS«
(*Eratosthenes Sieve Prime number in Pascal*)
program PRIME;
CONST
size = 8190;
VAR
flags: ARRAY (.0..size.) OF BOOLEAN;
i,prime, k, count,iter: INTEGER;
BEGIN
WRITELN(rvson,' PROGRAM PRIMES, 10 gentagelser. ', rvsoff);
FOR iter:= 1 TO 10 DO BEGIN; (* do program 10 times *)
count:= 0; (* prime counter *)
FOR i:= 0 to size do
flags (.i.):= TRUE; (* set flags all true *)
FOR i := 0 TO size DO
IF flags (.i.) THEN BEGIN (* found a prime *)
prime := i + i +3; (* twice the index + 3 *)
k:= i + prime; (* first multiple to kill *)
WHILE k <= size DO BEGIN
flags (.k.):= FALSE; (* zero a non prime *)
k:= k + prime; (* next multiple *)
END;
count:= count + 1 (* primes found *)
END;
END;
WRITELN(count, ' primes '); (* primes found in 19th pas *)
END.«eof»