提交记录
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull t,x;
ull euler_phi(ull n){
ull ans = n;
for(ull i = 2; i * i <= n; i++){
if(n % i == 0){
ans = ans / i * (i - 1);
while(n % i == 0) n /= i;
}
}
if(n > 1) ans = ans / n * (n - 1);
else if(n == 1) return 0;
return ans;
}
int main(){
while(cin >> x, x) cout << euler_phi(x) << endl;
return 0;
}