Pagini recente » Istoria paginii utilizator/ovidiu_moro | Cod sursa (job #2954964) | Istoria paginii utilizator/minhnhatnoe | Clasament dupa rating | Cod sursa (job #2024263)
#include <fstream>
#include <iostream>
#define Nmax 1000111
using namespace std;
int v[Nmax];
long long int n,s=0,rasp;
int main()
{
ifstream fin ("fractii.in");
ofstream fout ("fractii.out");
fin>>n;
for (int i=1;i<=n;++i)
{
v[i]=i-1;
}
for (int i=1;i<=n;++i)
{
for (int j=2*i;j<=n;j+=i)
{
v[j]-=v[i];
}
}
for (int i=1;i<=n;++i)
{
s+=v[i];
}
s=s*2+1;
fout<<s;
}