Pagini recente » Cod sursa (job #679662) | Borderou de evaluare (job #534448) | Cod sursa (job #3228173) | Cod sursa (job #623256) | Cod sursa (job #120510)
Cod sursa(job #120510)
#include <fstream.h>
using namespace std;
long long u[100001],tot[100001];
void totient()
{
long i,j;
for (i=2;i<=100000;i++)
tot[i]=i;
for (i=2;i<=100000;i++)
{
if (u[i]==0)
{
j=1;
while(i*j<=100000)
{
u[i*j]=1;
tot[i*j]=tot[i*j]-(tot[i*j]/i);
j++;
} }
}
}
int main()
{ long long n;
totient();
ifstream f1("sum.in");
ofstream f2("sum.out");
cin>>n;
cout<<n*2*tot[n];
return 0;
}