Class LogBinomialCoefficient


  • public final class LogBinomialCoefficient
    extends Object
    Natural logarithm of the binomial coefficient. It is "n choose k", the number of k-element subsets that can be selected from an n-element set.
    • Method Detail

      • value

        public static double value​(int n,
                                   int k)
        Computes the logarithm of the binomial coefficient. The largest value of n for which all coefficients can fit into a long is 66.
        Parameters:
        n - Size of the set.
        k - Size of the subsets to be counted.
        Returns:
        log(n choose k).
        Throws:
        IllegalArgumentException - if n < 0.
        IllegalArgumentException - if k > n.