Pagini recente » Cod sursa (job #27717) | Cod sursa (job #3160206) | Cod sursa (job #2207927) | Cod sursa (job #2268920) | 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.