Bell Number Calculator

Calculate Bell numbers, which count the number of ways to partition a set.

Calculate B_n

B_5

52

Number of ways to partition a set of 5 elements

Bell Sequence

B0=1B1=1B2=2B3=5B4=15B5=52B6=203B7=877B8=4,140B9=21,147B10=1,15,975B11=6,78,570

Stirling Decomposition of B_5

B_5 = Σ S(5, k) for k = 0 to 5

S(5,0)=0+S(5,1)=1+S(5,2)=15+S(5,3)=25+S(5,4)=10+S(5,5)=1=52

Bell Triangle

0
1
1
1
2
2
2
3
5
3
5
7
10
15
4
15
20
27
37
52
5
52
67
87
114
151
203
6
203
255
322
409
523
674
877
7
877
1080
1335
1657
2066
2589
3263
4140

Each row starts with the last element of the previous row. B_n is the first element of row n.

Formulas

Stirling Sum

B_n = Σ S(n,k) for k=0 to n

Recurrence

B_{n+1} = Σ C(n,k)×B_k

Dobinski's Formula

B_n = (1/e) × Σ k^n/k!

Exponential GF

Σ B_n×x^n/n! = e^(e^x-1)

What Are Bell Numbers?

Bell numbers (Bₙ) count the number of ways to partition a set with n labeled elements into non-empty, unlabeled subsets. For example, a 3-element set {a, b, c} can be partitioned in 5 ways: {a}{b}{c}, {a,b}{c}, {a,c}{b}, {b,c}{a}, and {a,b,c} — so B₃ = 5. The sequence begins B₀=1, B₁=1, B₂=2, B₃=5, B₄=15, B₅=52, and grows super-exponentially. This calculator computes Bₙ for any n between 0 and 20 using the efficient Bell triangle method.

Bell numbers appear throughout combinatorics — from counting rhyme schemes in poetry to analyzing equivalence relations and database partitioning strategies. The calculator also displays the underlying Bell triangle (also called the Aitken array or Peirce triangle) and the corresponding Stirling numbers of the second kind S(n,k) for the chosen n, showing how many partitions have exactly k blocks.

Bell Number Formula

Bell numbers can be computed via the Bell triangle, where the first entry of each row equals the last entry of the previous row, and each subsequent entry is the sum of the entry above and the entry to the left.

Bell Triangle Construction

Row 0: [1] Row i: start with last element of row i−1 For j = 2 to i+1: entry = entry_left + entry_above B_i = first element of row i

Where:

  • B_n= The nth Bell number — counts set partitions of an n-element set
  • S(n,k)= Stirling numbers of the second kind — count partitions of n elements into exactly k non-empty subsets. B_n = Σ S(n,k)

Understanding the Results

OutputDescription
B_nThe Bell number for the given n — total number of set partitions
Bell SequenceThe first numTerms Bell numbers, showing the rapid growth of the sequence
Bell TriangleThe first rows of the Bell triangle — the leftmost column gives Bell numbers
Stirling NumbersS(n,k) for all k from 0 to n showing the distribution of partition sizes

How to Use This Calculator

  1. Enter n: Choose a value from 0 to 20. The calculator computes B_n and all Stirling numbers S(n,k).
  2. Set sequence length: Control how many Bell numbers are displayed in the sequence view — useful for seeing the growth pattern.
  3. Read the results: The Bell triangle visualizes the construction; Stirling numbers show how partitions break down by number of blocks.

Real-World Applications

Bell numbers model set partitioning in combinatorics and computer science. Database sharding strategies that split records across servers correspond to set partitions. In machine learning, clustering algorithms partition data points into groups — the number of possible clusterings of n labeled items is B_n. In natural language processing, the number of ways to group words into phrases follows Bell number patterns.

In probability theory, the moments of the Poisson distribution are Bell numbers: the nth moment of a Poisson(1) distribution equals B_n. In chemistry, Bell numbers count the number of ways to arrange bonds in certain molecular structures. In poetry analysis, the number of possible rhyme schemes for a stanza of n lines is B_n.

Worked Examples

Bell Number for n=3

Problem:

Find B₃ and list all partitions of {a, b, c}.

Solution Steps:

  1. 1Enter n=3.
  2. 2Bell triangle: Row 0=[1], Row 1=[1,2], Row 2=[2,3,5], Row 3=[5,7,10,15]. B₃ = 5.
  3. 3S(3,1)=1 ({abc}), S(3,2)=3 ({a,bc},{b,ac},{c,ab}), S(3,3)=1 ({a},{b},{c}).

Result:

B₃ = 5. The 5 partitions are: {{a,b,c}} (1 block), {{a},{b,c}} {{b},{a,c}} {{c},{a,b}} (2 blocks each), and {{a},{b},{c}} (3 blocks).

Bell Number Growth

Problem:

Observe how quickly Bell numbers grow from n=0 to n=10.

Solution Steps:

  1. 1Set numTerms=12.
  2. 2Sequence: B₀=1, B₁=1, B₂=2, B₃=5, B₄=15, B₅=52, B₆=203, B₇=877, B₈=4140, B₉=21147, B₁₀=115975.

Result:

B₁₀ = 115,975 — over 100,000 ways to partition just 10 items. The growth is super-exponential.

Tips & Best Practices

  • Bell numbers for n > 20 exceed JavaScript's safe integer range — the calculator uses floating point for display.
  • The Bell triangle shows you each step of the construction — follow row by row to understand the recurrence.
  • Stirling numbers S(n,k) satisfy S(n,k) = k × S(n−1,k) + S(n−1,k−1) — this recurrence builds the triangle.
  • For n=0, B₀=1 because there's exactly one way to partition the empty set: with zero blocks.
  • The sequence grows approximately like n! / (log n)^{n} — super-exponentially fast.

Frequently Asked Questions

B_n counts the number of ways to split a set of n distinct elements into non-empty groups where the order of groups doesn't matter. For example, {1,2,3} has 5 partitions: one block of 3, three ways to have one block of 2 and one of 1, and one way to have three singleton blocks. Bell numbers grow extremely fast.
Stirling numbers of the second kind S(n,k) count partitions of n elements into exactly k non-empty subsets. The Bell number B_n is the sum of all Stirling numbers for that n: B_n = Σ_{k=0}^{n} S(n,k). The calculator shows both — the Bell number as the total and the Stirling row as the breakdown.
The Bell triangle (Aitken array) is an efficient way to compute Bell numbers without recursion or summation. Start with [1]. For each new row, copy the last element of the previous row, then fill right by adding the element above to the element just written. The first entry of each row is the next Bell number.
They are named after Eric Temple Bell, who wrote extensively about them in the 1930s, though they were studied earlier by Japanese mathematicians and appear in medieval Sanskrit combinatorics texts. Bell numbers are sometimes called 'exponential numbers' because of their appearance in the exponential generating function.

Sources & References

Last updated: 2026-06-06

💡

Help us improve!

How would you rate the Bell Number Calculator?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: Handbook of Mathematical Functions

by Abramowitz & Stegun

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.