Pagini recente » Cod sursa (job #481024) | Cod sursa (job #554630) | Cod sursa (job #2275181) | Cod sursa (job #2370477) | Cod sursa (job #3323639)
#include <bits/stdc++.h>
using namespace std;
ifstream f("sum.in");
ofstream g("sum.out");
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;
f >> n;
while(n--){
long long x;
f >> x;
int sum = 0;
for(long long i = 1; i <= 2 * x; i++){
if(gcd(i,x) == 1)
sum += i;
}
g << sum << '\n';
}
}