Pagini recente » Cod sursa (job #1287182) | Cod sursa (job #1883581) | Cod sursa (job #95319) | Cod sursa (job #60838) | Cod sursa (job #156227)
Cod sursa(job #156227)
var a:array[2..3000000] 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.