Pagini recente » Cod sursa (job #1171134) | Cod sursa (job #158604) | Cod sursa (job #1397128) | Cod sursa (job #2823644) | Cod sursa (job #660624)
Cod sursa(job #660624)
#include <iostream>
#include <fstream>
using namespace std;
int ggt(int a, int b)
{
if (a%b == 0)
return b;
return ggt(b,a%b);
}
int main(void)
{
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int a,x,y,ct=0;
fin>>a;
for(x=2;x<=a;x++)
{
for(y=2;y<x;y++)
{
if(ggt(x,y)==1)
ct++;
}
}
ct=2*(ct)+a-1+a;
fout<<ct;
return 0;
}