home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
01e
/
m2comp_b.zip
/
BADSIEV1.MOD
< prev
next >
Wrap
Text File
|
1987-07-04
|
865b
|
38 lines
MODULE sieve;
(* $L+ *)
FROM InOut IMPORT Read, Write, WriteString, WriteCard, WriteLn;
CONST
SIZE = 8190;
ITER = 10;
VAR
flag :ARRAY [0..SIZE] OF BOOLEAN;
i, j, k, count, prime :CARDINAL;
ch :CHAR;
BEGIN
WriteString("Hit a key to start 10 ITERATIONS");
Read(ch); WriteLn;
FOR i := 1 TO ITER DO
cnt := 0;
FOR j := 0 TO 10000 DO
flag[j] := TRUE;
END;
FOR j := 0 TO SIZE DO
IF flag[j] THEN
prime := j+j+3;
k := j+prime;
WHILE k <= SIZE DO
flag[k] := FALSE;
INC(k,prime);
END;
INC(count);
END;
END;
END;
Write(7C); WriteCard(count);
END sieve.