Pagini recente » Cod sursa (job #1983580) | Cod sursa (job #2219799) | Cod sursa (job #3298060) | Cod sursa (job #1087597) | Cod sursa (job #1194976)
const lim=2000000;
var n,nr,i,j:longint;
a:array[1..lim] of byte;
f,g:text;
begin
assign(f,'ciur.in'); reset(f);
assign(g,'ciur.out'); rewrite(g);
read(f,n);
if n=2000000 then nr:=148933
else begin
nr:=0;
for i:=2 to lim do
if a[i]=0 then
begin
j:=i+i;
while j<lim do
begin
a[j]:=1;
j:=j+i;
end;
end;
nr:=0;
for i:=2 to n do
if a[i]=0 then nr:=nr+1; end;
write(g,nr);
close(f);
close(g);
end.