Pagini recente » Cod sursa (job #499814) | Istoria paginii runda/forest_sprint_two_thousand_eleven | Profil M@2Te4i | Rating Burghelea Florin-Andrei (andreiushw) | Cod sursa (job #1610020)
#include <cstdio>
#define Nmax 100001
using namespace std;
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
int t,x,phi[Nmax];
for(int i=2;i<Nmax;i++)
phi[i]=i-1;
for(int i=2;i<Nmax;i++)
for(int j=i*2;j<Nmax;j+=i)
phi[j]-=phi[i];
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d",&x);
printf("%d\n",x*phi[x]*2);
}
}