- C20250278's blog
P1369欧拉函数
- 2023-3-6 9:55:46 @
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int phi =n;
for (int i=2;i*i<=n;i++){
if (n%i==0){
phi = phi / i * (i-1);
while (n % i==0) n = n / i;
}
}
if (n>1) phi =phi / n * (n-1);
cout<<phi<<endl;
return 0;
}