Pagini recente » Cod sursa (job #2312996) | Cod sursa (job #2061960) | Cod sursa (job #1388926) | Cod sursa (job #2552708) | Cod sursa (job #2130434)
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n,r,a,b,i,j,nr,c[1000001];
int main()
{
fin>>n;
for(i=1;i<=n;i++)
c[i]=i-1;
for(i=2;i<=n;i++)
{
for(j=i+i;j<=n;j+=i)
c[j]-=c[i];
}
for(i=1;i<=n;i++)
cout<<i<<" "<<c[i]<<"\n";
for(i=1; i<=n; i++)
{
nr=nr+2*c[i];
}
fout<<nr+1;
return 0;
}