Pagini recente » Cod sursa (job #1264522) | Cod sursa (job #950722) | Cod sursa (job #2537483) | Cod sursa (job #1201221) | Cod sursa (job #2404395)
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
unsigned int n,p,k,cp,C[1000001];
unsigned long long s;
/*void Ciur()
{
C[0]=C[1]=1;
for(unsigned int i=2;i*i<=n ;i++)
if(C[i]==0)
for(unsigned int j=i*2;j<=n;j+=i)
C[j]=1;
}
*/
int main()
{
fin>>n;
// Ciur();
for(unsigned int i=1; i<=n; i++)
{
if(i==1)
s+=1;
//else if(C[i]==0)
//s+=i-1;
else
{
cp=i;
p=2;
k=0;
while(cp>1)
{
while(cp%p==0)
{
k++;
cp=cp/p;
}
s=s+(p-1)*pow(p,k-1);
p++;
}
}
}
fout<<s*2-1;
return 0;
}