Pagini recente » Cod sursa (job #1404472) | Cod sursa (job #509213) | Cod sursa (job #2624040) | Cod sursa (job #1718429) | Cod sursa (job #1700467)
/********************
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;
}