Pagini recente » Cod sursa (job #97701) | Cod sursa (job #1697388) | Cod sursa (job #1981397) | Cod sursa (job #1179625) | Cod sursa (job #2718806)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
long long comb(long long a, long long b)
{
if(b == 0)
return 1;
return a * comb(a - 1, b - 1) / b;
}
long long gcd(long long a, long long b)
{
if(a % b == 0)
return b;
return gcd(b, a % b);
}
int main()
{
int n;
fin >> n;
int counter = 0;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= n; j ++)
if(gcd(i, j) == 1)
counter ++;
fout << counter;
}