Pagini recente » Statistici Zaharia Diana Cristiana (DianaZaharia132nr2) | Cod sursa (job #177566) | Cod sursa (job #770545) | Cod sursa (job #687440) | Cod sursa (job #203759)
Cod sursa(job #203759)
#include <stdio.h>
long phi[101000];
int main()
{
long n,i,x,j,q;
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
scanf("%ld\n",&n);
for (i=1; i<=101000; i++)
phi[i]=i-1;
for (i=2; i<=101000; i++)
for (j=i+i; j<=101000; j+=i)
phi[j]=phi[j]-phi[i];
for (i=1; i<=n; i++)
{
scanf("%ld",&x);
q=2*phi[x]*x;
printf("%ld\n",q);
}
}