Pagini recente » Cod sursa (job #29510) | Cod sursa (job #643671) | Monitorul de evaluare | Cod sursa (job #2516866) | Cod sursa (job #30276)
Cod sursa(job #30276)
program fractii;
var x:longint;
p,i:longint;
f:text;
function tot(a:longint):longint;
var i:word;
x:double;
begin
x:=a;
for i:=1 to round(sqrt(a)) do
if (a mod i=0)and(i<>1) then
x:=x*(1-1/i);
if (x=a) then x:=x-1;
tot:=round(x);
end;
begin
assign(f,'fractii.in');
reset(f);
read(f,p);
close(f);
for i:=2 to p do
x:=x+2*tot(i);
assign(f,'fractii.out');
rewrite(f);
write(f,tot(15));
close(f);
end.