Return the Euler totient function of n.
8486
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
897948
def worker(n):
    """"""
    for _ in xrange(999999):
        a = exp(n)
        b = exp(2*n)
    return n, a
1092358
def getprimeover(N):
    
    if HAVE_GMP:
        randfunc = random.SystemRandom()
        r = gmpy2.mpz(randfunc.getrandbits(N))
        r = gmpy2.bit_set(r, N - 1)
        return int(gmpy2.next_prime(r))
    elif HAVE_CRYPTO:
        return number.getPrime(N, os.urandom)
    else:
        randfunc = random.SystemRandom()
        n = randfunc.randrange(2**(N-1), 2**N) | 1
        while not is_prime(n):
            n += 2
        return n
654224
def nPr(n, r):
    
    f = math.factorial
    return int(f(n) / f(n-r))
405717
def IntGreaterThanZero(n):
    """"""
    try:
        n = int(n)
    except:
        raise ValueError("%s is not an integer" % n)
    if n <= 0:
        raise ValueError("%d is not > 0" % n)
    else:
        return n
672882
private static function _getMorphed($n, $f1, $f2, $f5) {
        $n  = abs($n) % 100;
        $n1 = $n % 10;
        if ($n > 10 && $n < 20) return $f5;
        if ($n1 > 1 && $n1 < 5) return $f2;
        if ($n1 == 1) return $f1;

        return $f5;
    }
714258
def _sigfigs(n, sigfigs=3):
    ''
    n = float(n)
    if n == 0 or math.isnan(n):  # avoid math domain errors
        return n
    return round(n, -int(math.floor(math.log10(abs(n))) - sigfigs + 1))
482961
function(n, k) {

    var p = 1;
    for (k = n - k; k < n; n--) {
      p *= n;
    }
    return p;
  }
184598
def divisors(n):
    
    factors = _factor_generator(n)
    _divisors = []
    listexponents = [[k**x for x in range(0, factors[k]+1)] for k in list(factors.keys())]
    listfactors = _cartesian_product(listexponents)
    for f in listfactors:
        _divisors.append(reduce(lambda x, y: x*y, f, 1))
    _divisors.sort()
    return _divisors
1229821
def to_euler_deg(self, euler_vec3):
        """"""
        sqw = self.w * self.w
        sqx = self.x * self.x
        sqy = self.y * self.y
        sqz = self.z * self.z

        euler_vec3.z = math.atan2(2.0 * (self.x * self.y + self.z * self.w),
                                  (sqx - sqy - sqz + sqw)
                                  ) * (180.0 / math.pi)
        euler_vec3.x = math.atan2(2.0 * (self.y * self.z + self.x * self.w),
                                  (-sqx - sqy + sqz + sqw)
                                  ) * (180.0 / math.pi)
        euler_vec3.y = math.asin(-2.0 * (self.x * self.z - self.y * self.w)
                                 ) * (180.0 / math.pi)
        return euler_vec3
1072075
def dcm(self):
        
        if self._dcm is None:
            if self._q is not None:
                # try to get dcm from q
                self._dcm = self._q_to_dcm(self.q)
            elif self._euler is not None:
                # try to get get dcm from euler
                self._dcm = self._euler_to_dcm(self._euler)
        return self._dcm
397301
function fromEuler (q, euler) {
  var x = euler[0]
  var y = euler[1]
  var z = euler[2]
  var cx = Math.cos(x / 2)
  var cy = Math.cos(y / 2)
  var cz = Math.cos(z / 2)
  var sx = Math.sin(x / 2)
  var sy = Math.sin(y / 2)
  var sz = Math.sin(z / 2)

  q[0] = sx * cy * cz + cx * sy * sz
  q[1] = cx * sy * cz - sx * cy * sz
  q[2] = cx * cy * sz + sx * sy * cz
  q[3] = cx * cy * cz - sx * sy * sz

  return q
}
308668
protected static function c(int $n) : float
    {
        if ($n <= 1) {
            return 1.;
        }
        
        return 2. * (log($n - 1) + M_EULER) - 2. * ($n - 1) / $n;
    }
949301
def get_n_r(self):
        """"""
        return math.floor(self.n / self.eta**self.i + _epsilon), math.floor(self.r * self.eta**self.i + _epsilon)
953618
def factorial(n):
    
    f = 1
    while (n > 0):
        f = f * n
        n = n - 1
    return f
1084839
def compute_factorial(n):
    
    sleep_walk(10)
    ret = 1
    for i in range(n):
        ret = ret * (i + 1)
    return ret
1343060
def fib(n):
    
    assert n > 0
    a, b = 1, 1
    for i in range(n - 1):
        a, b = b, a + b
    return a