欧拉函数
#include<iostream>
using namespace std;
const int N = 1e6+10;
int primes[N],phi[N],cnt;
bool st[N];
long long get_phi(int n)
{
phi[1] = 1;
for(int i=2;i<=n;++i)
{
if(!st[i]){//此处一定是质数
primes[cnt++] = i;
phi[i] = i - 1;// n * (1 - 1/n)
}
for(int j=0;primes[j]<=n/i;++j)
{
st[primes[j] * i] = true;
if(i % primes[j] == 0){
phi[primes[j] * i] = phi[i] * primes[j];
break;
}
phi[primes[j] * i] = phi[i] * (primes[j] - 1);
}
}
}
int main()
{
int n;
cin >> n;
cout << get_phi(n);
return 0;
}