Pagini recente » Cod sursa (job #2285660) | Cod sursa (job #1642747) | Cod sursa (job #734795) | Cod sursa (job #2547723) | Cod sursa (job #194387)
Cod sursa(job #194387)
var p : array[0..2000001] of byte;
i,rez,j,n,n1 : longint;
f,g : text;
begin
assign(f,'ciur.in');reset(f);
assign(g,'ciur.out');rewrite(g);
read(f,n);
n1:=trunc(sqrt(n));
for i:=2 to n1 do
if p[i]=0 then
begin
j:=i*i;
while j<=n do
begin
p[j]:=1;inc(j,i);
end;
end;
for i:=2 to n-1 do
if p[i]=0 then inc(rez);
writeln(g,rez);
close(g);
end.