Pagini recente » Borderou de evaluare (job #1567428) | Cod sursa (job #468798) | Cod sursa (job #3147315) | Cod sursa (job #204242) | Cod sursa (job #1717245)
/********************
Created by Sburly
********************/
#include <fstream>
using namespace std;
#define inf 100000
long int n;
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;
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--;)
{
long long int x;
f >> x;
g << 2*x*totient[x] << '\n';
}
return 0;
}