IntegerCombinatoricFunctions IΒΆ

combinat.spad line 1 [edit on github]

The IntegerCombinatoricFunctions package provides some standard functions in combinatorics.

binomial: (I, I) -> I

binomial(n, r) returns the binomial coefficient C(n, r) = n!/(r! (n-r)!), where n >= r >= 0. This is the number of combinations of n objects taken r at a time.

catalan: I -> I

catalan(n) returns the n-th Catalan number

distinct_partition: I -> I

distinct_partition(n) returns the number of partitions of the integer n with distinct members. This is the number of ways that n can be written as a sum of distinct positive integers. For n > 0 this is the same as number of ways that n can be written as a sum of odd positive integers.

factorial: I -> I

factorial(n) returns n!. this is the product of all integers between 1 and n (inclusive). Note: 0! is defined to be 1.

multinomial: (I, List I) -> I

multinomial(n, [m1, m2, ..., mk]) returns the multinomial coefficient n!/(m1! m2! ... mk!).

partition: I -> I

partition(n) returns the number of partitions of the integer n. This is the number of distinct ways that n can be written as a sum of positive integers.

permutation: (I, I) -> I

permutation(n) returns !P(n, r) = n!/(n-r)!. This is the number of permutations of n objects taken r at a time.

stirling1: (I, I) -> I

stirling1(n, m) returns the Stirling number of the first kind denoted S[n, m].

stirling2: (I, I) -> I

stirling2(n, m) returns the Stirling number of the second kind denoted SS[n, m].