Pagini recente » Istoria paginii runda/test3452 | Cod sursa (job #1238170) | Cod sursa (job #1831146) | Cod sursa (job #963148) | Cod sursa (job #30271)
Cod sursa(job #30271)
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 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,x+1);
close(f);
end.