Cod sursa(job #3323637)
| Utilizator | Data | 18 noiembrie 2025 22:03:31 | |
|---|---|---|---|
| Problema | Sum | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#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';
}
}
