Pagini recente » Cod sursa (job #1173220) | Cod sursa (job #1210279) | Cod sursa (job #2423887) | Cod sursa (job #2588900) | Cod sursa (job #1414410)
program ciur;
type tabel=array[0..2000001] of byte;
var t:tabel;
n,i,j,sol:longint;
f1,f2:text;
function ciur(n:longint):longint;
begin
i:=2;
while (i*i<=n) do begin
if t[i]=0 then begin
j:=i*i;
while (j<=n) do begin
if t[j]=0 then sol:=sol-1; t[j]:=t[j]+1;
j:=j+i;
end; end;
i:=i+1;
end;
ciur:=sol;
end;
begin
assign (f1,'ciur.in');
assign (f2,'ciur.out');
reset (f1);
rewrite (f2);
readln (f1,n); sol:=n-1;
writeln (f2,ciur(n));
close (f1);
close (f2);
end.