This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub beet-aizu/library
#ifndef call_from_test #include <bits/stdc++.h> using namespace std; #endif //BEGIN CUT HERE template<typename T> T totient(T n){ T res=n; for(T i=2;i*i<=n;i++){ if(n%i) continue; res=res/i*(i-1); while(n%i==0) n/=i; } if(n!=1) res=res/n*(n-1); return res; } //END CUT HERE #ifndef call_from_test signed main(){ return 0; } #endif
#line 1 "math/totient.cpp" #include <bits/stdc++.h> using namespace std; #endif //BEGIN CUT HERE template<typename T> T totient(T n){ T res=n; for(T i=2;i*i<=n;i++){ if(n%i) continue; res=res/i*(i-1); while(n%i==0) n/=i; } if(n!=1) res=res/n*(n-1); return res; } //END CUT HERE #ifndef call_from_test signed main(){ return 0; } #endif