Pagini recente » Cod sursa (job #296049) | Cod sursa (job #2271490) | Cod sursa (job #1574305) | Cod sursa (job #132384) | Cod sursa (job #1148979)
#include <cstdio>
const int Xmax = int(1e5) + 5;
int ans[Xmax];
inline int readInt() {
int result = 0;
static char ch;
ch = getc(stdin);
while (ch < '0' || ch > '9')ch = getc(stdin);
while ('0' <= ch && ch <= '9') {
result = result * 10 + (ch - '0');
ch = getc(stdin);
}
return result;
}
int main()
{
freopen("sum.in", "r", stdin);
freopen("sum.out", "w", stdout);
for (int i = 2; i < Xmax; i++) {
ans[i] += (i - 1);
for (int j = i + i; j < Xmax; j += i) {
ans[j] -= ans[i];
}
}
int x;
int testCount = readInt();
while (testCount--) {
x = readInt();
printf("%lld\n",2LL * ans[x] * x );
}
return 0;
}