Pagini recente » Cod sursa (job #1058054) | Cod sursa (job #1329905) | Cod sursa (job #3002928) | Cod sursa (job #548365) | Cod sursa (job #1717003)
/********************
Created by Sburly
********************/
#include <fstream>
using namespace std;
#define inf 100001
long int n;
int totient[inf];
int main()
{
ifstream f("sum.in");
ofstream g("sum.out");
f >> n;
for (unsigned long int i=1;i<=inf;++i)
totient[i]=i;
for (unsigned long int i=2;i<=inf;++i)
if (totient[i]==i)
{
for (unsigned long int j=i;j<=inf;j+=i)
totient[j] /=i, totient[j] *= (i-1);
}
for(unsigned long int i = n; i; --i)
{
long long int x;
f >> x;
g << 2*x*totient[x] << '\n';
}
return 0;
}