Pagini recente » Cod sursa (job #2865019) | Cod sursa (job #2877746) | Cod sursa (job #1790739) | Cod sursa (job #2610032) | Cod sursa (job #1334636)
#include <cstdio>
using namespace std;
int ce[100005];
void ciur(int n){
for(int i=2;i<=n;i++){
ce[i]=i;
}
for(int i=2;i<=n;i++){
if(ce[i]==i){
for(int j=2*i;j<=n;j=j+i){
ce[j]=ce[j]/i;
ce[j]*=(i-1);
}
ce[i]=i-1;
}
}
}
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
int n,t;
ciur(100000);
scanf("%d",&t);
for(int i=1;i<=t;i++){
scanf("%d",&n);
printf("%lld\n",2ll*n*ce[n]);
}
return 0;
}