Binomial coefficient
    >>> binomial(5,2)
    10
    >>> binomial(10,5)
    252
188354
def binomial(n,k):
    
    if n==k: return 1
    assert n>k, "Attempting to call binomial(%d,%d)" % (n,k)
    return factorial(n)//(factorial(k)*factorial(n-k))
21368
function nbits(x) {
	var n = 1, t;
	if ((t = x >>> 16) != 0) {
		x = t;
		n += 16;
	}
	if ((t = x >> 8) != 0) {
		x = t;
		n += 8;
	}
	if ((t = x >> 4) != 0) {
		x = t;
		n += 4;
	}
	if ((t = x >> 2) != 0) {
		x = t;
		n += 2;
	}
	if ((t = x >> 1) != 0) {
		x = t;
		n += 1;
	}
	return n;
}
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
285221
def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
    
    return ((num == 0) and numerals[0]) or \
        (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])
111804
def EvalBinomialPmf(k, n, p):
    
    return scipy.stats.binom.pmf(k, n, p)
888491
public static boolean alg_68(int[] blz, int[] number) {
        // 10-stellige
        if (number[0] != 0) {
            if (number[3] != 9) {
                return false;
            }
            int sum = addProducts(number, 3, 8, new int[]{1, 2, 1, 2, 1, 2}, true);
            int crc = (10 - sum % 10) % 10;
            return number[9] == crc;
        }

        // 9-stellige Ausnahme (Ausnahme nur bei Variante 2??)
        if (number[1] == 4) {
            // nicht pruefbar
            return true;
        }

        // auf 6stelligkeit pruefen
        int sumfirstfive = 0;
        for (int i = 0; i <= 4; i++) {
            sumfirstfive += number[i];
        }
        //mindestens 6-stellig
        if (sumfirstfive == 0) {
            return false;
        }

        //Variante 1
        int sum = addProducts(number, 1, 8, new int[]{1, 2, 1, 2, 1, 2, 1, 2}, true);
        int crc = (10 - sum % 10) % 10;
        if (number[9] == crc) {
            return true;
        }

        //Variante 2
        sum = addProducts(number, 1, 8, new int[]{1, 0, 0, 2, 1, 2, 1, 2}, true);
        crc = (10 - sum % 10) % 10;
        return number[9] == crc;
    }
1135095
function () {
        _gpfBinZ = 36969 * (_gpfBinZ & 65535) + (_gpfBinZ >> 16) & _gpfMax32;
        _gpfBinW = 18000 * (_gpfBinW & 65535) + (_gpfBinW >> 16) & _gpfMax32;
        return ((_gpfBinZ << 16) + _gpfBinW & _gpfMax32) + _gpfMax31;
    }
124555
def fast_exponentiation2(a, b, q):
    
    assert a >= 0 and b >= 0 and q >= 1
    p = 0               # only for documentation
    p2 = 1              # 2 ** p
    ap2 = a % q         # a ** (2 ** p)
    result = 1
    while b > 0:
        if p2 & b > 0:  # b's binary decomposition contains 2 ** p
            b -= p2
            result = (result * ap2) % q
        p += 1
        p2 *= 2
        ap2 = (ap2 * ap2) % q
    return result
591543
def _g_func(self):
        
        return (self.n**4./32.
                * ((jv(self.n-2., self.n*self.e_vals)
                   - 2. * self.e_vals*jv(self.n-1., self.n*self.e_vals)
                   + 2./self.n * jv(self.n, self.n*self.e_vals)
                   + 2.*self.e_vals*jv(self.n+1., self.n*self.e_vals)
                   - jv(self.n+2., self.n*self.e_vals))**2.
                   + (1.-self.e_vals**2.) * (jv(self.n-2., self.n*self.e_vals)
                   - 2.*jv(self.n, self.n*self.e_vals)
                   + jv(self.n+2., self.n*self.e_vals))**2.
                   + 4./(3.*self.n**2.)*(jv(self.n, self.n*self.e_vals))**2.))
1159322
public static long count(int n, int m) {
		if(n == m) {
			return NumberUtil.factorial(n);
		}
		return (n > m) ? NumberUtil.factorial(n, n - m) : 0;
	}
302468
def base26int(s, _start=1 - ord('A')):
    
    return sum((_start + ord(c)) * 26**i for i, c in enumerate(reversed(s)))
729194
function fibonacci(num, memo = {}) {
	if (memo[num]) return memo[num];
	if (num <= 1) return 1;

	return (memo[num] = fibonacci(num - 1, memo) + fibonacci(num - 2, memo));
}
1066382
def _reduce_22(val, _values, result)
 n = val[0]; result = n.count('.') > 0 ? n.to_f : n.to_i 
    result
end
153694
function calcBezier(aT, aA1, aA2) {
    return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
  }
868396
def _psi_n(x, n, b):
    
    return 2**(b-1) / gamma(b) * (-1)**n * \
    np.exp(gammaln(n+b) -
           gammaln(n+1) +
           np.log(2*n+b) -
           0.5 * np.log(2*np.pi*x**3) -
           (2*n+b)**2 / (8.*x))
889074
def int2roman(val):
    
    s = ''
    pos10 = 1000
    for pos in range(3, -1, -1):
        digit = val // pos10
        s += roman[pos][digit]
        val %= pos10
        pos10 //= 10
    return s
414894
function binomcoef( n, k ) {
	var res, j;

	if ( isInteger( n ) && isInteger( k ) ) {
		if ( n < 0 ) {
			res = binomcoef( -n + k - 1, k );
			if ( isodd( k ) ) {
				res = -res;
			}
			return res;
		}
		if( n < k ) {
			return 0;
		}
		if ( n - k < k ) {
			k = n - k;
		}
		if (k <	 0) {
			return 0;
		} else if (k === 0) {
			return 1;
		} else {
			// use recursive definition
			res = n;
			for( j = 2; j <= k; j++ ) {
				res *= ( n - j + 1 ) / j;
			}
			// correct for rounding errors
			return !isInteger( res ) ? round( res ) : res;
		}
	} else {
		// generalized version for real numbers
		res = - ln( n + 1 ) - betaln( n - k + 1, k + 1 );
		return exp( res );
	}
}