Class BellSequence

java.lang.Object
org.episteme.core.mathematics.analysis.series.BellSequence
All Implemented Interfaces:
Function<Natural,Integer>, Function<Natural,Integer>, Relation<Natural,Integer>, IntegerSequence, Sequence<Integer>

public class BellSequence extends Object implements IntegerSequence
Bell numbers sequence (OEIS A000110).

The Bell number B(n) counts the number of partitions of a set with n elements. For example:

  • B(0) = 1: {{}} (empty set has 1 partition)
  • B(1) = 1: {{1}}
  • B(2) = 2: {{1,2}}, {{1},{2}}
  • B(3) = 5: {{1,2,3}}, {{1,2},{3}}, {{1,3},{2}}, {{2,3},{1}}, {{1},{2},{3}}

Recurrence Relations

Bell numbers satisfy several recurrence relations:

B(n+1) = Σ(k=0 to n) C(n,k) * B(k)
where C(n,k) is the binomial coefficient "n choose k".

They can also be computed using the Bell triangle (Aitken's array):

1
1  2
2  3  5
5  7  10  15
15 20 27  37  52
Each row starts with the last element of the previous row, and each element is the sum of the element to its left and the element above-left.

Properties

  • Exponential generating function: exp(e^x - 1)
  • Asymptotic behavior: B(n) ~ (n/log n)^n / e^(n/log n - n)
  • Growth rate: faster than exponential

OEIS Reference

A000110

References

  • Bell, E. T. (1934). "Exponential polynomials"
  • Comtet, L. (1974). "Advanced Combinatorics"
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • BellSequence

      public BellSequence()
  • Method Details

    • get

      public Integer get(Natural n)
      Description copied from interface: Sequence
      Returns the n-th term of the sequence (0-indexed).

      This is the canonical method using Episteme number types.

      Specified by:
      get in interface Sequence<Integer>
      Parameters:
      n - the index (n ≥ 0)
      Returns:
      a(n)
    • computeBellExplicit

      public BigInteger computeBellExplicit(int n)
      Computes Bell number using the explicit summation formula. Less efficient but useful for verification.
      Parameters:
      n - the index
      Returns:
      B(n)
    • getOEISId

      public String getOEISId()
      Description copied from interface: Sequence
      Returns the OEIS (Online Encyclopedia of Integer Sequences) identifier. For example, "A000045" for Fibonacci numbers.
      Specified by:
      getOEISId in interface Sequence<Integer>
      Returns:
      OEIS ID or null if not catalogued
    • getFirstN

      public BigInteger[] getFirstN(int count)
      Returns the first n Bell numbers.
      Parameters:
      count - number of terms
      Returns:
      array of Bell numbers [B(0), B(1), ..., B(n-1)]
    • toString

      public String toString()
      Overrides:
      toString in class Object