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 coefficientC(n, r) = n!/(r! (n-r)!)
, wheren >= r >= 0
. This is the number of combinations ofn
objects takenr
at a time.
- catalan: I -> I
catalan(n)
returns then
-th Catalan number
- distinct_partition: I -> I
distinct_partition(n)
returns the number of partitions of the integern
with distinct members. This is the number of ways thatn
can be written as a sum of distinct positive integers. Forn > 0
this is the same as number of ways thatn
can be written as a sum of odd positive integers.
- factorial: I -> I
factorial(n)
returnsn!
. this is the product of all integers between 1 andn
(inclusive). Note:0!
is defined to be 1.
- multinomial: (I, List I) -> I
multinomial(n, [m1, m2, ..., mk])
returns the multinomial coefficientn!/(m1! m2! ... mk!)
.
- partition: I -> I
partition(n)
returns the number of partitions of the integern
. This is the number of distinct ways thatn
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 ofn
objects takenr
at a time.
- stirling1: (I, I) -> I
stirling1(n, m)
returns the Stirling number of the first kind denotedS[n, m]
.
- stirling2: (I, I) -> I
stirling2(n, m)
returns the Stirling number of the second kind denotedSS[n, m]
.