Bell and Uppuluri-Carpenter numbers - Combinatorics

Skip to content
Back to top
View this page
Edit this page

# Bell and Uppuluri-Carpenter numbers

AUTHORS:

- Nick Alexander

sage.combinat.expnums.expnums(n, aa)

  Compute the first \(n\) exponential numbers around \(aa\), starting with the zero-th.

  INPUT:

  - `n` – C machine int

  - `aa` – C machine int

  OUTPUT: list of length \(n\)

  ALGORITHM: We use the same integer addition algorithm as GAP. This is an extension of Bell’s triangle to the general case of exponential numbers. The recursion performs \(O(n^2)\) additions, but the running time is dominated by the cost of the last integer addition, because the growth of the integer results of partial computations is exponential in \(n\). The algorithm stores \(O(n)\) integers, but each is exponential in \(n\).

  EXAMPLES:

  Sage

      sage: expnums(10, 1)
      [1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147]

  Python

      >>> from sage.all import *
      >>> expnums(Integer(10), Integer(1))
      [1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147]

  Sage

      sage: expnums(10, -1)
      [1, -1, 0, 1, 1, -2, -9, -9, 50, 267]

  [Python]

      >>> from sage.all import *
      >>> expnums(Integer(10), -Integer(1))
      [1, -1, 0, 1, 1, -2, -9, -9, 50, 267]

  Sage

      sage: expnums(1, 1)
      [1]
      sage: expnums(0, 1)
      []
      sage: expnums(-1, 0)
      []

  Python

      >>> from sage.all import *
      >>> expnums(Integer(1), Integer(1))
      [1]
      >>> expnums(Integer(0), Integer(1))
      []
      >>> expnums(-Integer(1), Integer(0))
      []

  AUTHORS:

  - Nick Alexander

sage.combinat.expnums.expnums2(n, aa)

  A vanilla python (but compiled via Cython) implementation of expnums.

  We Compute the first \(n\) exponential numbers around \(aa\), starting with the zero-th.

  EXAMPLES:

  Sage

      sage: from sage.combinat.expnums import expnums2
      sage: expnums2(10, 1)
      [1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147]

  Python

      >>> from sage.all import *
      >>> from sage.combinat.expnums import expnums2
      >>> expnums2(Integer(10), Integer(1))
      [1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147]