Pagini recente » Cod sursa (job #994196) | Cod sursa (job #2464529) | Statistici Ciort Elena Cristina (Cristina-Elena) | Cod sursa (job #2957675) | Cod sursa (job #625261)
Cod sursa(job #625261)
program ciur_erathosthenes;
var n,i,j,t,h:longint;
d,o:text;
begin
assign(d,'ciur.in');
assign(o,'ciur.out');
reset(d);rewrite(o);
read(d,n);
t:=n-1;
for i:=2 to (n div 2) do
begin
j:=i*2;
while j<=n do
begin
t:=t-1;
for h:=i+1 to (j div 2) do
if j mod h=0 then begin
t:=t+1;
break;
end;
j:=j+i;
end;
end;
write(o,t);
close(d);close(o);
end.