Package edu.jas.arith
Class Combinatoric
java.lang.Object
edu.jas.arith.Combinatoric
Combinatoric algorithms. Similar to ALDES/SAC2 SACCOMB module.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BigInteger
binCoeff
(int n, int k) Integer binomial coefficient.static BigInteger
binCoeffInduction
(BigInteger A, long n, long k) Integer binomial coefficient induction.static BigInteger
binCoeffSum
(int n, int k) Integer binomial coefficient partial sum.static BigInteger
factorial
(long n) Factorial.
-
Constructor Details
-
Combinatoric
public Combinatoric()
-
-
Method Details
-
binCoeffInduction
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
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
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
Factorial.- Parameters:
n
- integer.- Returns:
- n!, with 0! = 1.
-