Pagini recente » Cod sursa (job #1543794) | Cod sursa (job #68388) | Cod sursa (job #645604) | Cod sursa (job #1627531) | Cod sursa (job #1717283)
/********************
Created by Sburly
********************/
#include <fstream>
using namespace std;
int totient[100001];
int main()
{
ifstream f("sum.in");
ofstream g("sum.out");
long int n;
f >> n;
int i,j;
for (i=1;i<100001;++i)
totient[i]=i;
for (i=2;i<100001;++i)
if (totient[i]==i)
for (j=i;j<100001;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;
}