Pagini recente » Monitorul de evaluare | Cod sursa (job #1482901) | Cod sursa (job #521850) | Diferente pentru problema/segmente intre reviziile 12 si 1 | Cod sursa (job #3323637)
#include <bits/stdc++.h>
using namespace std;
const int XMAX = 2 * 1e5 + 1;
long long gcd(long long a, long long b){
while(b){
long long r = a % b;
a = b;
b = r;
}
return a;
}
int main(){
int n;
cin >> n;
while(n--){
long long x;
cin >> x;
int sum = 0;
for(long long i = 1; i <= 2 * x; i++){
if(gcd(i,x) == 1)
sum += i;
}
cout << sum << '\n';
}
}