combinat-0.2.3.1: Generation of various combinatorial objects.

Math.Combinat.Numbers

Description

A few important number sequences.

See the "On-Line Encyclopedia of Integer Sequences", http://www.research.att.com/~njas/sequences/ .

Synopsis

# Documentation

paritySign :: Integral a => a -> IntegerSource

`(-1)^k`

factorial :: Integral a => a -> IntegerSource

A000142.

doubleFactorial :: Integral a => a -> IntegerSource

A006882.

binomial :: Integral a => a -> a -> IntegerSource

A007318.

# Catalan numbers

catalan :: Integral a => a -> IntegerSource

Catalan numbers. OEIS:A000108.

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

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.

# Bernoulli numbers

bernoulli :: Integral a => a -> RationalSource

Bernoulli numbers. `bernoulli 1 == -1%2` and `bernoulli k == 0` for k>2 and odd. This function uses the formula involving Stirling numbers of the second kind. Numerators: A027641, denominators: A027642.

# Power series

coinSeries :: [Int] -> [Integer]Source

Power series expansion of

``` @1 / ( (1-x^a_1) * (1-x^a_2) * ... * (1-x^a_n) )@
```

Example:

`(coinSeries [2,3,5]) !! k` is the number of ways to pay `k` dollars with coins of two, three and five dollars.

TODO: better name?