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