Cod sursa(job #120510)
| Utilizator | Data | 5 ianuarie 2008 19:20:39 | |
|---|---|---|---|
| Problema | Sum | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#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;
}
