Pagini recente » Cod sursa (job #426565) | Cod sursa (job #1882790) | Cod sursa (job #37964) | Cod sursa (job #1130761) | Cod sursa (job #584713)
Cod sursa(job #584713)
#include<stdio.h>
long long int n,i,j,a[100001],x,k,xxx;
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
scanf("%lld",&n);
a[1]=1;
for(i=2;i<=100000;i++)
if(!a[i])
for(j=i;j<=100000;j=j+i)
{
if(!a[j])
a[j]=1;
k=j/i;
a[j]*=i-1;
while(k%i==0)
{
a[j]*=i;
k/=i;
}
}
for(i=1;i<=n;i++)
{
scanf("%lld",&xxx);
printf("%lld\n",2*xxx*a[xxx]);
}
return 0;
}