def phi(n):
 assert isinstance(n, integer_types)
 if (n < 3):
  return 1
 result = 1
 ff = factorization(n)
 for f in ff:
  e = f[1]
  if (e > 1):
   result = ((result * (f[0] ** (e - 1))) * (f[0] - 1))
  else:
   result = (result * (f[0] - 1))
 return result

def phi ( n ) : assert isinstance ( n , integer_types ) if ( n < 3 ) : return 1 result = 1 ff = factorization ( n ) for f in ff : e = f [ 1 ] if ( e > 1 ) : result = ( ( result * ( f [ 0 ] ** ( e - 1 ) ) ) * ( f [ 0 ] - 1 ) ) else : result = ( result * ( f [ 0 ] - 1 ) ) return result
return the euler totient function of n .