Pagini recente » Cod sursa (job #3229040) | Cod sursa (job #3322764) | Cod sursa (job #30391) | Cod sursa (job #1421904) | 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';
}
}