Package dev.nm.number.big
Class BigIntegerUtils
- java.lang.Object
-
- dev.nm.number.big.BigIntegerUtils
-
public final class BigIntegerUtils extends Object
These are the utility functions to manipulateBigInteger.- See Also:
- Class BigInteger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigIntegercombination(int n, int k)Compute the combination function or the binomial coefficient.static BigIntegerfactorial(int n)Compute the n factorial.static BigIntegerpermutation(int n, int k)Compute the permutation function.
-
-
-
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 setk- 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 setk- the size of a permutation- Returns:
n! / (n-k)!- See Also:
- Wikipedia: Permutation
-
-