Pagini recente » Cod sursa (job #3245392) | Cod sursa (job #2372409) | Cod sursa (job #2594240) | Cod sursa (job #469977) | Cod sursa (job #150587)
Cod sursa(job #150587)
var v:array[1..2000000]of byte;
n,i,j,k:longint;
begin
assign(input,'ciur.in');reset(input);
assign(output,'ciur.out');rewrite(output);
read(n);
for i:=2 to trunc(sqrt(n)) do
if v[i]=0 then begin inc(k);for j:=2 to n div i do v[i*j]:=1;end;
j:=0;
writeln(k);
for i:=n downto 2 do
if v[i]=0 then begin
k:=i;
inc(j);
if j=1000 then break;
end;
for i:=k to n do if v[i]=0 then write(i,' ');
close(input);close(output);
end.