Pagini recente » Cod sursa (job #3289734) | Cod sursa (job #3202819) | Cod sursa (job #3212215) | Rating Banu Matei Costin (mateibanu) | Cod sursa (job #1198873)
var b:array[2..2000001] of boolean;
i,j: longint;
t: text;
s,n: longint;
begin
assign(t,'ciur.in');
reset(t);
readln(t,n);
close(t);
j:=1;s:=0;
while (sqr(j)<=n) do begin
inc(j);
if not(b[j]) then begin
i:=sqr(j);
inc(s);
while (i<=n) do begin
b[i]:=true;
i:=i+j;
end;
end;
end;
dec(j);
// for i:=2 to 10 do writeln(b[i]); halt;
while (j<n) do begin
inc(j);
// writeln(j,' ',b[j],' ',s);
if not(b[j]) then inc(s);
end;
assign(t,'ciur.out');
rewrite(t);
writeln(t,s);
close(t);
end.