Pagini recente » Cod sursa (job #573096) | Cod sursa (job #2146390) | Cod sursa (job #626731) | Cod sursa (job #2371509) | Cod sursa (job #1777821)
#include <bits/stdc++.h>
using namespace std;
//ifstream fin("sum.in");
ofstream fout("sum.out");
int N, testCount, X, solution;
int v[100010];
int main()
{
freopen("sum.in", "r", stdin);
//fin >> testCount;
fscanf(stdin,"%d", &testCount);
for(int i = 1; i <= 100000; i ++)
{
v[i] = i;
}
for(int i = 2; i <= 100000; i ++)
{
if(v[i] == i)
{
for(int j = i; j < 100000; j += i)
{
v[j] = v[j] / i * (i - 1);
}
}
}
while(testCount --)
{
//fin >> X;
fscanf(stdin,"%d", &X);
unsigned long long solution = 1LL * X * v[X] * 2;
fout << solution << '\n';
}
return 0;
}