Package edu.jas.arith
Class Combinatoric
- java.lang.Object
-
- edu.jas.arith.Combinatoric
-
public class Combinatoric extends java.lang.Object
Combinatoric algorithms. Similar to ALDES/SAC2 SACCOMB module.- Author:
- Heinz Kredel
-
-
Constructor Summary
Constructors Constructor Description Combinatoric()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigInteger
binCoeff(int n, int k)
Integer binomial coefficient. n and k are integers with 0 less than or equal to k less than or equal to n.static BigInteger
binCoeffInduction(BigInteger A, long n, long k)
Integer binomial coefficient induction. n and k are integers with 0 less than or equal to k less than or equal to n.static BigInteger
binCoeffSum(int n, int k)
Integer binomial coefficient partial sum. n and k are integers, 0 le k le n.static BigInteger
factorial(long n)
Factorial.
-
-
-
Constructor Detail
-
Combinatoric
public Combinatoric()
-
-
Method Detail
-
binCoeffInduction
public static BigInteger binCoeffInduction(BigInteger A, long n, long k)
Integer binomial coefficient induction. n and k are integers with 0 less than or equal to k less than or equal to n. A is the binomial coefficient n over k. B is the binomial coefficient n over k+1.- Parameters:
A
- previous induction result.n
- long.k
- long.- Returns:
- the binomial coefficient n over k+1.
-
binCoeff
public static BigInteger binCoeff(int n, int k)
Integer binomial coefficient. n and k are integers with 0 less than or equal to k less than or equal to n. A is the binomial coefficient n over k.- Parameters:
n
- long.k
- long.- Returns:
- the binomial coefficient n over k+1.
-
binCoeffSum
public static BigInteger binCoeffSum(int n, int k)
Integer binomial coefficient partial sum. n and k are integers, 0 le k le n. A is the sum on i, from 0 to k, of the binomial coefficient n over i.- Parameters:
n
- long.k
- long.- Returns:
- the binomial coefficient partial sum n over i.
-
factorial
public static BigInteger factorial(long n)
Factorial.- Parameters:
n
- integer.- Returns:
- n!, with 0! = 1.
-
-