Pagini recente » Cod sursa (job #61257) | Cod sursa (job #649151) | Cod sursa (job #1828587) | Cod sursa (job #1212604) | Cod sursa (job #1717258)
/********************
Created by Sburly
********************/
#include <fstream>
using namespace std;
#define inf 100000
#define inf2 50000
long int n;
int totient[inf+1];
int main()
{
ifstream f("sum.in");
ofstream g("sum.out");
//int totient[inf+1];
f >> n;
for (unsigned long int i = 1; i != inf; ++i)
totient[i] = i-1;
for (unsigned long int i = 2; i != inf2; ++i)
for (unsigned long int j = 2*i; j <= inf; j += i)
totient[j] -= totient[i];
for(unsigned long int i = n; i--;)
{
long long int x;
f >> x;
g << 2*x*totient[x] << '\n';
}
return 0;
}