Calculate n choose r.

    :param n: n
    :type n : int
    :param r: r
    :type r :int
    :return: n choose r as int
341225
def ncr(n, r):
    
    r = min(r, n - r)
    numer = reduce(op.mul, range(n, n - r, -1), 1)
    denom = reduce(op.mul, range(1, r + 1), 1)
    return numer // denom
254957
def toOrdinal(n):
    
    if n == -1:
        retval = _("last")
    elif n == -2:
        retval = _("penultimate")
    elif 1 <= n <= 5:
        retval = _n2w(n, to="ordinal")
    else:
        retval = _n2w(n, to="ordinal_num")
    return retval
351094
def take(self, n):
        
        if n <= 0:
            return self._transform(transformations.take_t(0))
        else:
            return self._transform(transformations.take_t(n))
609181
def BB(n):
    """"""
    if (n<=1):return Context('0\n1')
    else:
        BB1=BB(n-1)
        AA1=AA(n-1)
        r1 = C1((n-1)*2**(n-2),2**(n-1)) - AA1 - BB1
        r2 = BB1 - C1(2**(n-1),2**(n-1)) - BB1;
        return r1 + r2
651486
def r2z(r):
    
    with np.errstate(invalid='ignore', divide='ignore'):
        return 0.5 * (np.log(1 + r) - np.log(1 - r))
996300
def drop(self, n):
        
        if n <= 0:
            return self._transform(transformations.drop_t(0))
        else:
            return self._transform(transformations.drop_t(n))
377216
def combination(n, r):
    """"""
    if n == r or r == 0:
        return 1
    else:
        return combination(n-1, r-1) + combination(n-1, r)
879807
def combination_memo(n, r):
    """"""
    memo = {}
    def recur(n, r):
        if n == r or r == 0:
            return 1
        if (n, r) not in memo:
            memo[(n, r)] = recur(n - 1, r - 1) + recur(n - 1, r)
        return memo[(n, r)]
    return recur(n, r)
756706
def IntGreaterThanOne(n):
    """"""
    try:
        n = int(n)
    except:
        raise ValueError("%s is not an integer" % n)
    if n <= 1:
        raise ValueError("%d is not > 1" % n)
    else:
        return n
927642
public static double choose(int n, int k) {
        if (n < 0 || k < 0) {
            throw new IllegalArgumentException(String.format("Invalid n = %d, k = %d", n, k));
        }

        if (n < k) {
            return 0.0;
        }

        return Math.floor(0.5 + Math.exp(logChoose(n, k)));
    }
27929
def arange_col(n, dtype=int):
    
    return np.reshape(np.arange(n, dtype = dtype), (n, 1))
1256666
def rec_apply(func, n):
    
    if n > 1:
        rec_func = rec_apply(func, n - 1)
        return lambda x: func(rec_func(x))
    return func
21379
def RR_calc(classes, TOP):
    
    try:
        class_number = len(classes)
        result = sum(list(TOP.values()))
        return result / class_number
    except Exception:
        return "None"
876507
def range_n(self):
        """"""
        return self.sphere_index - self.dn, self.sphere_index + self.dn
905320
def _calculateXi(self, r):
        
        a = self._a
        return  (r - a)/(r + a)
372032
def inc_n(self, n, exception=None):  # type: (int, Optional[ParseError]) -> bool
        
        return self._src.inc_n(n=n, exception=exception)
1373175
def trunc_if_integer(n: Any) -> Any:
    
    if n == int(n):
        return int(n)
    return n