Pagini recente » Cod sursa (job #1013487) | Cod sursa (job #2704433) | Cod sursa (job #330131) | Cod sursa (job #3042214) | Cod sursa (job #1346355)
//#include <iostream>
#include <fstream>
#include<vector>
using namespace std;
ifstream cin("fractii.in");
ofstream cout("fractii.out");
int n,i,j;
int b[1000000],s=1;
vector<pair<int,int> > v[1000000];
int main(){
cin>>n;
for(i=2;i<=n;i++){
if(v[i].size()>0){
continue;
}
for(j=i;j<=n;j+=i){
int x=j,nr=0;
while(x%i==0){
nr++;
x/=i;
}
v[j].push_back(make_pair(i,nr));
}
}
for(i=2;i<=n;i++){
int nr=1;
for(j=0;j<v[i].size();j++){
int a=v[i][j].first;
int b=v[i][j].second;
while(b>1){
nr*=a;
b--;
}
nr*=(a-1);
}
s+=2*nr;
}
cout<<s;
return 0;
}