Tool for calculating Bell numbers (counting partitions of sets). Discover the formulas, examples, and applications in discrete mathematics.
Bell Numbers - dCode
Tag(s) : Combinatorics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
A Bell number, $ B_n $, is the number of ways to partition a set of $ n $ distinct elements into nonempty, disjoint subsets.
Example: $ B_3 = 5 $, because for a set $ \{a, b, c\} $, the 5 partitions are: $ \{\{a\}, \{b\}, \{c\}\} $, $ \{\{a, b\}, \{c\}\} $, $ \{\{a, c\}, \{b\}\} $, $ \{\{b, c\}, \{a\}\} $ and $ \{\{a, b, c\}\} $
The calculation of Bell numbers by recurrence is given by the formula: $$ B_{n+1} = \sum_{k=0}^{n} \binom{n}{k} B_k $$
To partition a set of $ n+1 $ elements, fix an element $ x $. For each $ k $ (the number of elements outside the subset containing $ x $), choose $ k $ elements from $ n $, and then partition these $ k $ elements.
It is possible to calculate Bell numbers using another infinite series formula: $$ B_n = \frac{1}{e} \sum_{k=0}^{\infty} \frac{k^n}{k!} $$
The first 50 values of $ B_n $ are: 1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975, 678570, 4213597, 27644437, 190899322, 1382958545, 10480142147, 82864869804, 682076806159, 5832742205057, 51724158235372, 474869816156751, 4506715738447323, 44152005855084346, 445958869294805289, 4638590332229999353, 49631246523618756274, 545717047936059989389, 6160539404599934652455, 71339801938860275191172, 846749014511809332450147, 10293358946226376485095653, 128064670049908713818925644, 1629595892846007606764728147, 21195039388640360462388656799, 281600203019560266563340426570, 3819714729894818339975525681317, 52868366208550447901945575624941, 746289892095625330523099540639146, 10738823330774692832768857986425209, 157450588391204931289324344702531067, 2351152507740617628200694077243788988, 35742549198872617291353508656626642567, 552950118797165484321714693280737767385, 8701963427387055089023600531855797148876, 139258505266263669602347053993654079693415, 2265418219334494002928484444705392276158355, 37450059502461511196505342096431510120174682, 628919796303118415420210454071849537746015761, 10726137154573358400342215518590002633917247281, 185724268771078270438257767181908917499221852770
See OEIS A000110 here
Bell's triangle (or Aitken's triangle) is a triangular arrangement of numbers that allows for the efficient calculation of Bell numbers $ B_n $.
It is constructed from binomial coefficients and reflects the recurrence relation of Bell numbers:
$$ B_{n+1} = \sum_{k=0}^n \binom{n}{k} $$
Construction:
— The first row contains only the number 1 ($ B_0 $)
— Each subsequent row begins with the last calculated Bell number.
— Subsequent numbers are obtained by adding the previous number to the one above it.
Example: 1
1 2
2 3 5
5 7 10 15
The first column directly gives the Bell numbers.
Bell numbers are the sum of Stirling numbers of the second kind: $$ B_n = \sum_{k=0}^n S(n, k) $$
Where $ S(n, k) $ is the function that counts the number of partitions of a set of $ n $ elements into $ k $ subsets. The sum over $ k $ gives all possible partitions.
dCode retains ownership of the "Bell Numbers" source code. Any algorithm for the "Bell Numbers" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Bell Numbers" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Bell Numbers" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Bell Numbers" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Bell Numbers on dCode.fr [online website], retrieved on 2026-01-08,