Pagini recente » Cod sursa (job #2213006) | Cod sursa (job #3041553) | Cod sursa (job #3190130) | Cod sursa (job #1495965) | Cod sursa (job #2212563)
#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<<e[nr]*nr*2;
}
return 0;
}