//FPC 2.6.4 Program sieve_of_Eratosthenes; var n, i, x:integer; a: array[1..32000] of boolean; begin readln(n); for i:=2 to (n+1) div 2 do begin x:=i*2; while x<=n do begin a[x]:=true; x:=x+i; end; x:=0; end; for i:=1 to n do if not a[i] then write(i,' '); readln; end.
Program sieve_of_Eratosthenes;
var
n, i, x:integer;
a: array[1..32000] of boolean;
begin
readln(n);
for i:=2 to (n+1) div 2 do
begin
x:=i*2;
while x<=n do
begin
a[x]:=true;
x:=x+i;
end;
x:=0;
end;
for i:=1 to n do if not a[i] then write(i,' ');
readln;
end.