Pagini recente » Cod sursa (job #735979) | Cod sursa (job #1880413) | Cod sursa (job #1465268) | Cod sursa (job #207878) | Cod sursa (job #146947)
Cod sursa(job #146947)
var v:array [1..2000000] of integer;
n,i,j,k:longint;
begin
assign(input,'ciur.in'); reset(input);
assign(output,'ciur.out'); rewrite(output);
readln(n);
for i:=2 to n do
if v[i]=0 then begin
inc(k);
for j:=2 to n div i do v[i*j]:=1;
end;
writeln(k); j:=0;
for i:=n downto 1 do begin
inc(j);
if v[i]=0 then write(i,' ');
if j=1000 then break;
end;
close(input); close(output);
end.