Pagini recente » Cod sursa (job #2198377) | Cod sursa (job #2481945) | Cod sursa (job #1725252) | Cod sursa (job #597045) | Cod sursa (job #2460497)
var b,n,i,p,last,count:longint;
este:boolean;
var x:array[1..2001000] of boolean;
fin,fout:textfile;
begin
assign(fin,'ciur.in');
reset(fin);
assign(fout,'ciur.out');
rewrite(fout);
readln(fin,n);
p:=2;
i:=2;
x[1]:=True;
x[2]:=False;
while este=false do begin
while i<=n do begin
i:=i+p;
// writeln('i=',i);
if x[i]=false then count:=count+1 ;
x[i]:=True;
end;
if count=0 then este:=true;
count:=0;
for i:=p to n do begin
if (i>p) and (x[i]=False) then begin
// writeln('p=',p);
p:=i;
break;
end;
end;
i:=p;
end;
{for i:=1 to n do
if n mod i=0 then
inc(a);
if a=2 then x[n]:=false
else x[n]:=true;}
for i:=1 to n do
if x[i]=false then inc(b);
writeln(fout,b);
close(fin);
close(fout);
end.