Pagini recente » Cod sursa (job #444558) | Cod sursa (job #709043) | Cod sursa (job #1688537) | Cod sursa (job #970356) | Cod sursa (job #364495)
Cod sursa(job #364495)
program fractii;
var i,n:longint;
nf:real;
f:text;
function nrdiv(x:longint):longint;
var nd,i:longint;
begin
nd:=1;
i:=2;
repeat
if x mod i=0 then
begin
nd:=nd+ n div i-1;
while x mod i =0 do
x:=x div i;
end;
i:=i+1;
until x=1;
nrdiv:=nd
end;
begin
assign(f,'cifre.in');
reset(f);
readln(f,n);
close(f);
nf:=n;
for i:=2 to n do
nf:=nf+n - nrdiv(i);
assign(f,'fractii.out');
rewrite(f);
write(f,nf:0:0);
close(f);
end.