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