This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub
#include "C++/math/euler_phi.hpp"
#pragma once template <class T> inline T euler_phi(T n) { T res = n; for(T i = 2; i * i <= n; ++i) { if(n % i == 0) { res -= res / i; while(n % i == 0) { n /= i; } } } if(n > 1) { res -= res / n; } return res; } /** * @brief Euler's Phi-function */
#line 2 "C++/math/euler_phi.hpp" template <class T> inline T euler_phi(T n) { T res = n; for(T i = 2; i * i <= n; ++i) { if(n % i == 0) { res -= res / i; while(n % i == 0) { n /= i; } } } if(n > 1) { res -= res / n; } return res; } /** * @brief Euler's Phi-function */