Pagini recente » Cod sursa (job #663844) | Cod sursa (job #659949) | Cod sursa (job #1108445) | Cod sursa (job #2205592) | Cod sursa (job #352021)
Cod sursa(job #352021)
#include<cstdio>
#define N 1000001
long long s=0,e[N];
long long i,n;
void era(int n)
{
long long i,j;
for(i=2;i<=n;++i)
e[i]=i;
for(i=2;i<=n;++i)
if(e[i]==i)
for(j=i;j<=n;j=j+i)
e[j]=e[j]/i*(i-1); }
int main()
{
freopen("fractii.in","r",stdin);
freopen("fractii.out","w",stdout);
scanf("%lld",&n);
era(n);
for(i=2;i<=n;++i)
s+=e[i];
printf("%lld",2*s+1);
return 0;
}