Pagini recente » Cod sursa (job #2256519) | Cod sursa (job #1916008) | Cod sursa (job #2853470) | Cod sursa (job #2961502) | Cod sursa (job #803474)
Cod sursa(job #803474)
var n,j,x,i:longint;
a:array [1..100000] of longint;
f,g:text;
b1,b2: array [1..1 shl 17] of char;
begin
assign(f,'sum.in');
assign(g,'sum.out');
settextbuf(f,b1);
settextbuf(g,b2);
reset(f);
rewrite(g);
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(f,n);
for i:=1 to n do
begin
readln(f,x);
writeln(g,int64(a[x])*int64(x shl 1));
end;
close(f);
close(g);
end.