Pagini recente » Cod sursa (job #1509825) | Cod sursa (job #1613950) | Cod sursa (job #1227630) | Cod sursa (job #196863) | Cod sursa (job #30262)
Cod sursa(job #30262)
program fractii;
var x:longint;
p,i:longint;
f:text;
function tot(a:longint):longint;
var i:word;
x:real;
begin
x:=a;
for i:=1 to a do
if (a mod i=0)and(i<>1) then
x:=x*(1-1/i);
tot:=round(x);
end;
begin
assign(f,'fractii.in');
reset(f);
read(f,p);
close(f);
for i:=1 to p do
x:=x+2*tot(i);
assign(f,'fractii.out');
rewrite(f);
write(f,x-1);
close(f);
end.