Pagini recente » Istoria paginii runda/simulare | Cod sursa (job #647542) | Cod sursa (job #1483281) | Cod sursa (job #1281948) | Cod sursa (job #2428246)
#include<bits/stdc++.h>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n, x;
const int xmax = 100005;
int phi[xmax];
void indicatorul_euler()
{
for (int i = 1; i <= xmax - 5; i++) phi[i] = i - 1;
for (int i = 1; i <= xmax; i++)
for (int j = i + i; j <= xmax; j += i)
phi[j] -= phi[i];
}
int main()
{
indicatorul_euler();
long long s = 0;
fin >> n;
for (int i = 1; i <= n; i++)
s += phi[i];
fout << 1ll * s * 2 + 1 << "\n";
return 0;
}