Class BigIntegerUtils

    • Method Detail

      • factorial

        public static BigInteger factorial​(int n)
        Compute the n factorial.
        Parameters:
        n - an integer
        Returns:
        n!
        See Also:
        Wikipedia: Factorial
      • combination

        public static BigInteger combination​(int n,
                                             int k)
        Compute the combination function or the binomial coefficient. It is the number of k-combinations (each of size k) from a set k with n elements (size n).
        Parameters:
        n - the size of the full set
        k - the size of a combination
        Returns:
        n! / (n-k)! / k!
        See Also:
        Wikipedia: Combination
      • permutation

        public static BigInteger permutation​(int n,
                                             int k)
        Compute the permutation function. It is the number of k-permutations (each of size k) from a set k with n elements (size n).
        Parameters:
        n - the size of the full set
        k - the size of a permutation
        Returns:
        n! / (n-k)!
        See Also:
        Wikipedia: Permutation