Java Binomial Coefficients binomial(int n, final int k)

Here you can find the source of binomial(int n, final int k)

Description

binomial

License

Open Source License

Declaration

public static long binomial(int n, final int k) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static long binomial(int n, final int k) {
        final int min = (k < n - k ? k : n - k);
        long bin = 1;
        for (int i = 1; i <= min; i++) {
            bin *= n;/* w  w w . j  a v a  2  s . c om*/

            bin /= i;
            n--;
        }
        return bin;
    }
}

Related

  1. binomial(final int n, final int k)
  2. binomial(int n, double p)
  3. binomial(int N, int K)
  4. binomial(int n, int k)
  5. binomialCdf(int k, int n, double p)
  6. binomialCoeff(int n, int k)