docs: def phi( n ):
    """Return the Euler totient function of 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