|
|
DataMuseum.dkPresents historical artifacts from the history of: RC4000/8000/9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC4000/8000/9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1536 (0x600)
Types: TextFile
Names: »prime2tx «
└─⟦01e83a425⟧ Bits:30008166 Bånd med SW8010 og SW8500 source code
└─⟦75ff9bef3⟧
└─⟦this⟧ »prime2tx «
program prime2 (input, output);
const
n=100; æn = n div 2å
type
positive = 1..maxint;
var
sieve, primes : set of 2..n;
nextprime, multiple, newprime : positive;
count : integer;
begin æinitializeå
count := 0; sieve := Æ2..nÅ; primes := ÆÅ; nextprime := 2;
repeat æ find next primeå
while not (nextprime in sieve) do
nextprime := succ (nextprime);
primes := primes + ÆnextprimeÅ;
newprime := 2 * nextprime - 1;
multiple := nextprime;
while multiple <= n do æeliminateå
begin
sieve := sieve - ÆmultipleÅ;
multiple := multiple + nextprime;
end;
write (nextprime:6);
count := count + 1;
if (count mod 8) = 0 then
writeln (output);
until sieve = ÆÅ;
end.
▶EOF◀