Pagini recente » Cod sursa (job #2219512) | Cod sursa (job #3255044) | Cod sursa (job #262918) | Cod sursa (job #632564) | Cod sursa (job #1148967)
#include <fstream>
using namespace std;
const int Xmax = int(1e5) + 5;
int ans[Xmax];
int main()
{
ifstream cin("sum.in");
ofstream cout("sum.out");
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 testCount;
int x;
cin >> testCount;
while (testCount--) {
cin >> x;
cout << 2LL * ans[x] * x << "\n";
}
return 0;
}