Pagini recente » Cod sursa (job #2067340) | Cod sursa (job #530419) | Cod sursa (job #2135518) | Cod sursa (job #2374288) | Cod sursa (job #156223)
Cod sursa(job #156223)
var a:array[2..2000001] of boolean;
i,j,n,k:longint;
f,g:text;
begin
assign(f,'ciur.in'); reset(f);
assign(g,'ciur.out'); rewrite(g);
readln(f,n); close(f);
fillchar(a,sizeof(a),true);
k:=0;
for i := 2 to trunc(sqrt(n)) do
if a[i] then begin
j:=2;
while i*j <=n do begin
a[i*j]:=false;
inc(j);
end;
end;
k:=0;
for i := 2 to n do
if a[i] then inc(k);
writeln(g,k);
close(f);
close(g);
end.