Pagini recente » Cod sursa (job #2543263) | Cod sursa (job #1644106) | Cod sursa (job #3170960) | Cod sursa (job #1228636) | Cod sursa (job #1700481)
/********************
Created by Sburly
********************/
#include <fstream>
using namespace std;
long long int totient[1000001];
long long int sol = 0;
long long int n;
int main()
{
ifstream f("fractii.in");
ofstream g("fractii.out");
f >> n;
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;
}