Combinatorial functions
This section is about basic combinatorial functions that arise in the context of counting problems. Usually, there are indirect ways of counting—like closed formulas—instead of having to explicitly create the list of objects in question. More special combinatorial functions that count objects we have implemented (e.g. restricted partitions) are discussed in the respective sections.
Nemo.bell
— Functionbell(n::T) where T<:Union{Int,fmpz}
The n-th Bell number Bₙ. This counts the number of partitions of an n-element set.
The implementation is the one from Nemo which in turn uses the one from FLINT.
Refences
- Wikipedia, Bell number
- The On-Line Encyclopedia of Integer Sequences, A000110
Base.binomial
— Functionbinomial(n::T, k::T) where T<:Union{Int,fmpz}
The binomial coefficient ${n \choose k}$. This counts the number of k-element subsets of an n-element set.
For type fmpz
the implementation is the one from Nemo which in turn uses the one from FLINT.
Refences
- Wikipedia, Binomial coefficient
JuLie.catalan
— Functioncatalan(n::fmpz)
catalan(n::Integer)
The n-th Catalan number Cₙ. This counts all sorts of things, e.g. the number of expressions containing n pairs of parentheses which are correctly matched.
The computation simply uses the formula
\[C_n = \frac{1}{n+1}{ 2n \choose n} \;.\]
Refences
- Wikipedia, Catalan number
- The On-Line Encyclopedia of Integer Sequences, A000108
JuLie.euler
— Function euler(n::fmpz)
euler(n::Integer)
The n-th Euler number. The implementation is a wrapper to FLINT.
References
- Wikipedia, Euler numbers
- The On-Line Encyclopedia of Integer Sequences, A122045
Base.factorial
— Functionfactorial(n::T) where T<:Union{Int,fmpz}
The factorial of n. This counts the number of permuations of n distinct objects.
For type fmpz
the implementation is the one from Nemo which in turn uses the one from FLINT.
Refences
JuLie.lucas
— Functionlucas(n::fmpz)
lucas(n::Integer)
The n-th Lucas number. The implementation is a wrapper to the function in GMP.
References
- Wikipedia, Lucas number
- The On-Line Encyclopedia of Integer Sequences, A000032
JuLie.stirling1
— Functionstirling1(n::fmpz, k::fmpz)
stirling1(n::Integer, k::Integer)
The Stirling number S₁(n,k) of the first kind. The absolute value of S₁(n,k) counts the number of permutations of n elements with k disjoint cycles. The implementation is a wrapper to the function in FLINT.
References
- Wikipedia, Stirling numbers of the first kind
- The On-Line Encyclopedia of Integer Sequences, A008275
JuLie.stirling2
— Functionstirling2(n::fmpz, k::fmpz)
stirling2(n::Integer, k::Integer)
The Stirling number S₂(n,k) of the second kind. This counts the number of partitions of an n-element set into k non-empty subsets. The implementation is a wrapper to the function in FLINT.
References
- Wikipedia, Stirling numbers of the second kind
- The On-Line Encyclopedia of Integer Sequences, A008277