Pagini recente » Cod sursa (job #1728046) | Cod sursa (job #2966976) | Cod sursa (job #876883) | Cod sursa (job #1018756) | Cod sursa (job #1603744)
var i,j,n,x:longint;
sum:int64;
function cmmdc(a,b:longint):longint;
begin
if a=b then cmmdc:=a
else if a>b then cmmdc:=cmmdc(a-b,b)
else cmmdc:=cmmdc(a,b-a);
end;
begin
assign(input,'sum.in'); reset(input);
readln(input,n);
for j:=1 to n do
begin
readln(input,x);
sum:=1;
for i:=2 to x*2 do
if cmmdc(i,x)=1 then sum:=sum+i;
writeln(sum);
end;
assign(output,'sum.out'); rewrite(output);
write(output,sum); close(input); close(output);
end.