Pagini recente » Istoria paginii utilizator/opal | Expresii 2 | Diferente pentru utilizator/apocalypto intre reviziile 183 si 182 | Diferente pentru utilizator/ruxandra985 intre reviziile 30 si 85 | Cod sursa (job #1036163)
var a:array[1..2000000] of byte;
i,j,n,nr:integer;
f,g:text;
begin
assign(f,'ciur.in');reset(f);
assign(g,'ciur.out');rewrite(g);
readln(f,n);close(f);
nr:=0;
for i:=2 to (trunc(sqrt(n))+1) do
if a[i]=0 then begin
j:=2*i;
a[j]:=1;
while j<=n do begin
j:=j+i;
a[j]:=1;
end;
end;
for i:=2 to n do if a[i]=0 then inc(nr);
write(g,nr);close(g);
end.