Pagini recente » Cod sursa (job #1134516) | Cod sursa (job #2186964) | Cod sursa (job #235091) | Cod sursa (job #1316680) | Cod sursa (job #1700469)
/********************
Created by Sburly
********************/
#include <fstream>
using namespace std;
int main()
{
ifstream f("fractii.in");
ofstream g("fractii.out");
long int n;
f >> n;
long int totient[n+1];
long int sol = 0;
for (long int i = 1; i <= n; ++i)
totient[i] = i-1;
for (long int i = 2; i <= n; ++i)
{
sol+=totient[i];
for (long int j = 2*i; j <= n; j += i)
totient[j] -= totient[i];
}
g << sol*2+1;
return 0;
}