home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
fpkbin99.zip
/
DEMOS
/
ERATOS.PAS
next >
Wrap
Pascal/Delphi Source File
|
1998-10-12
|
897b
|
40 lines
{****************************************************************************
Copyright (c) 1993,94 by Florian Klämpfl
Translated By Eric Molitor (emolitor@freenet.fsu.edu)
****************************************************************************}
{ Demonstration Program in FPKPascal }
{ Calculates all Prime Numbers from 1 to max }
program eratosthenes;
const
max = 1000000;
procedure eratos;
var
a : array[1..max] of boolean;
i,j : longint;
begin
a[1]:=false;
for i:=1 to max do
a[i]:=true;
for i:=2 to max div 2 do
for j:=2 to max div i do
a[i*j]:=false;
writeln;
for i:=1 to max do
if a[i] then
write(i:8);
writeln;
end;
begin
write('Calculating the Prime Numbers from 1 to ',max,'...');
eratos;
end.