Pagini recente » Cod sursa (job #2865042) | Cod sursa (job #2250995) | Cod sursa (job #1440188) | Cod sursa (job #2249918) | Cod sursa (job #2114273)
#include <fstream>
#include <iostream>
using namespace std;
int v[1000005];
int main(){
ifstream fin ("fractii.in");
ofstream fout ("fractii.out");
int n;
long long int nr=1;
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=j+i){
v[j]-=v[i];
}
}
for(int i=1; i<=n; i++){
nr=nr+2*v[i];
}
fout<<nr<<endl;
return 0;
}