Pagini recente » Cod sursa (job #2804975) | Clasament Teme ACM Unibuc 2013 | Cod sursa (job #1435018) | Cod sursa (job #1323417) | Cod sursa (job #1334633)
#include <cstdio>
using namespace std;
int ce[200009];
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-1)/i;
}
ce[i]=i-1;
}
}
}
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
int n,t;
ciur(200005);
scanf("%d",&t);
for(int i=1;i<=t;i++){
scanf("%d",&n);
printf("%lld\n",2ll*n*ce[n]);
}
return 0;
}