Pagini recente » Monitorul de evaluare | Atasamentele paginii Welcome! :D | Statistici hanu pompiliu (georgehanu) | Monitorul de evaluare | Cod sursa (job #1388894)
#include <cstdio>
#define nmax 100002
using namespace std;
long long vect[80002],i,j,x,t;
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
for(i=2;i<=nmax/2;i++)
vect[i]=i-1;
for(i=2;i<=nmax/2;i++)
for(j=2*i;j<=nmax/2;j+=i)
vect[j]-=vect[i];
scanf("%ld",&t);
for(i=1;i<=t;i++)
{
scanf("%lld",&x);
printf("%lld\n",1ll*x*2*vect[x]);
}
return 0;
}