Pagini recente » Cod sursa (job #1227675) | Cod sursa (job #2213791) | Cod sursa (job #2973368) | Cod sursa (job #330946) | Cod sursa (job #2973464)
#include <bits/stdc++.h>
using namespace std;
bool isReductible(int a, int b){
if (a < b) swap(a, b);
while(b){
int t = b;
b = a % t;
a = t;
}
if (a == 1) return true;
else return false;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
freopen("fractii.in", "r", stdin);
freopen("fractii.out", "w", stdout);
int n;
cin >> n;
int ras = 0;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++)
if (isReductible(i, j)) ras += 1;
}
cout << ras;
return 0;
}