Pagini recente » Cod sursa (job #2437959) | Cod sursa (job #3186491) | Cod sursa (job #3190119) | Cod sursa (job #2436075) | Cod sursa (job #4642)
Cod sursa(job #4642)
const k=100000;
var f,f2:text;
a:array[2..k] of int64;
n,x,i,j:longint;
begin
for i:=2 to k do a[i]:=i;
for i:=2 to k do begin
if a[i]=i then begin
a[i]:=i-1;
for j:=2 to (k div i) do a[j*i]:=a[j*i]-a[j*i] div i;
end;
end;
for i:=2 to k do a[i]:=a[i]*i*2;
assign(f,'sum.in');
reset(f);
readln(f,n);
assign(f2,'sum.out');
rewrite(f2);
for i:=1 to n do begin
readln(f,x);
writeln(f2,a[x]);
end;
close(f);
close(f2);
end.