Pagini recente » Cod sursa (job #3130279) | Cod sursa (job #2403558) | Cod sursa (job #2945602) | Cod sursa (job #2764644) | Cod sursa (job #602471)
Cod sursa(job #602471)
Program sum_2;
var n,j,x,i:longint;
a:array [1..100000] of longint;
fi,fo:text;
b1,b2: array [1..1 shl 17] of char;
begin
assign(fi,'sum.in');
assign(fo,'sum.out');
settextbuf(fi,b1);
settextbuf(fo,b2);
reset(fi);
rewrite(fo);
a[1]:=1;
for i:=2 to 100000 do
a[i]:=i-1;
for i:=2 to 50000 do begin
j:=2*i;
while j<=100000 do begin
a[j]:=a[j]-a[i];
j:=j+i;
end;
end;
readln(fi,n);
for i:=1 to n do begin
readln(fi,x);
writeln(fo,int64(a[x])*int64(x shl 1));
end;
close(fo);
end.