Pagini recente » Cod sursa (job #2352251) | Cod sursa (job #2260850) | Cod sursa (job #48606) | Cod sursa (job #1396407) | Cod sursa (job #2778404)
#include <fstream>
#define ll unsigned long long
#define limit 100000
using namespace std;
ifstream cin("sum.in");
ofstream cout("sum.out");
ll n, x;
int indicator[limit + 1];
void ind_euler(){
for(int i = 1; i <= limit; i++)
indicator[i] = i;
for(int i = 2; i <= limit; i++){
if(indicator[i] == i){
indicator[i]++; // il pun si pe 1
for(int j = i; j <= limit; j += i)
indicator[j] = indicator[j] / i * (i - 1);
}
}
}
int main(){
cin >> n;
ind_euler();
for(int i = 1; i <= n; i++){
cin >> x;
cout << indicator[x] * 2LL * x << "\n";
}
}