Pagini recente » Cod sursa (job #305895) | Cod sursa (job #510643) | Cod sursa (job #2941718) | Cod sursa (job #2441690) | Cod sursa (job #2101628)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n;
long long int nr;
bool cmmdc(int x, int y)
{
int z;
if(x<y)
swap(x,y);
while(x%y)
{
z=x%y;
x=y;
y=z;
}
if(y==1)
return true;
return false;
}
int main()
{
fin>>n;
nr=n;
for(int i=2; i<=n; ++i)
for(int j=1; j<=n; ++j)
if(cmmdc(i,j))
nr++;
fout<<nr<<'\n';
return 0;
}