Pagini recente » Cod sursa (job #391911) | Cod sursa (job #2599494) | Cod sursa (job #2976012) | Cod sursa (job #2579361) | Cod sursa (job #2212565)
#include <iostream>
#include <cstdio>
#define MAX 100000
using namespace std;
int e[MAX+1];
void Euler() {
int i,j;
for(i=2;i<=MAX;i++)
e[i]=i;
for(i=2;i<=MAX;i++)
if(e[i]==i)
for(j=i;j<=MAX;j+=i)
e[j]=e[j]/i*(i-1);
}
int main() {
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
int n,nr,i;
scanf("%d",&n);
Euler();
for(i=1;i<=n;i++) {
scanf("%d",&nr);
cout<<1LL*e[nr]*nr*2<<'\n';
}
return 0;
}