Safe Haskell | None |
---|
A few important number sequences.
See the "On-Line Encyclopedia of Integer Sequences", https://oeis.org .
- paritySign :: Integral a => a -> Integer
- factorial :: Integral a => a -> Integer
- doubleFactorial :: Integral a => a -> Integer
- binomial :: Integral a => a -> a -> Integer
- pascalRow :: Integral a => a -> [Integer]
- multinomial :: Integral a => [a] -> Integer
- catalan :: Integral a => a -> Integer
- catalanTriangle :: Integral a => a -> a -> Integer
- signedStirling1stArray :: Integral a => a -> Array Int Integer
- signedStirling1st :: Integral a => a -> a -> Integer
- unsignedStirling1st :: Integral a => a -> a -> Integer
- stirling2nd :: Integral a => a -> a -> Integer
- bernoulli :: Integral a => a -> Rational
Documentation
paritySign :: Integral a => a -> IntegerSource
(-1)^k
doubleFactorial :: Integral a => a -> IntegerSource
A006882.
pascalRow :: Integral a => a -> [Integer]Source
A given row of the Pascal triangle; equivalent to a sequence of binomial numbers, but much more efficient. You can also left-fold over it.
pascalRow n == [ binomial n k | k<-[0..n] ]
multinomial :: Integral a => [a] -> IntegerSource
Catalan numbers
catalanTriangle :: Integral a => a -> a -> IntegerSource
Catalan's triangle. OEIS:A009766. Note:
catalanTriangle n n == catalan n catalanTriangle n k == countStandardYoungTableaux (toPartition [n,k])
Stirling numbers
signedStirling1stArray :: Integral a => a -> Array Int IntegerSource
Rows of (signed) Stirling numbers of the first kind. OEIS:A008275.
Coefficients of the polinomial (x-1)*(x-2)*...*(x-n+1)
.
This function uses the recursion formula.
signedStirling1st :: Integral a => a -> a -> IntegerSource
(Signed) Stirling numbers of the first kind. OEIS:A008275.
This function uses signedStirling1stArray
, so it shouldn't be used
to compute many Stirling numbers.
unsignedStirling1st :: Integral a => a -> a -> IntegerSource
(Unsigned) Stirling numbers of the first kind. See signedStirling1st
.
stirling2nd :: Integral a => a -> a -> IntegerSource
Stirling numbers of the second kind. OEIS:A008277. This function uses an explicit formula.