# Bell number

In combinatorial mathematics, the **Bell numbers** count the possible partitions of a set. These numbers have been studied by mathematicians since the 19th century, and their roots go back to medieval Japan.^{[1]} In an example of Stigler's law of eponymy, they are named after Eric Temple Bell, who wrote about them in the 1930s.

The Bell numbers are denoted *B*_{n}, where *n* is an integer greater than or equal to zero. Starting with *B*_{0} = *B*_{1} = 1, the first few Bell numbers are

The Bell number *B*_{n} counts the number of different ways to partition a set that has exactly *n* elements, or equivalently, the number of equivalence relations on it. *B _{n}* also counts the number of different rhyme schemes for

*n*-line poems.

^{[2]}

As well as appearing in counting problems, these numbers have a different interpretation, as moments of probability distributions. In particular, *B _{n}* is the

*n*th moment of a Poisson distribution with mean 1.

As suggested by the set notation above, the ordering of subsets within the family is not considered; ordered partitions are counted by a different sequence of numbers, the ordered Bell numbers. *B*_{0} is 1 because there is exactly one partition of the empty set. This partition is itself the empty set; it can be interpreted as a family of subsets of the empty set, consisting of zero subsets. It is vacuously true that all of the subsets in this family are non-empty subsets of the empty set and that they are pairwise disjoint subsets of the empty set, because there are no subsets to have these unlikely properties.

The partitions of a set correspond one-to-one with its equivalence relations. These are binary relations that are reflexive, symmetric, and transitive. The equivalence relation corresponding to a partition defines two elements as being equivalent when they belong to the same partition subset as each other. Conversely, every equivalence relation corresponds to a partition into equivalence classes.^{[3]} Therefore, the Bell numbers also count the equivalence relations.

If a number *N* is a squarefree positive integer (meaning that it is the product of some number *n* of distinct prime numbers), then *B _{n}* gives the number of different multiplicative partitions of

*N*. These are factorizations of

*N*into numbers greater than one, treating two factorizations as the same if they have the same factors in a different order.

^{[4]}For instance, 30 is the product of the three primes 2, 3, and 5, and has

*B*

_{3}= 5 factorizations:

The Bell numbers also count the rhyme schemes of an *n*-line poem or stanza. A rhyme scheme describes which lines rhyme with each other, and so may be interpreted as a partition of the set of lines into rhyming subsets. Rhyme schemes are usually written as a sequence of Roman letters, one per line, with rhyming lines given the same letter as each other, and with the first lines in each rhyming set labeled in alphabetical order. Thus, the 15 possible four-line rhyme schemes are AAAA, AAAB, AABA, AABB, AABC, ABAA, ABAB, ABAC, ABBA, ABBB, ABBC, ABCA, ABCB, ABCC, and ABCD.^{[2]}

The Bell numbers come up in a card shuffling problem mentioned in the addendum to Gardner (1978). If a deck of *n* cards is shuffled by repeatedly removing the top card and reinserting it anywhere in the deck (including its original position at the top of the deck), with exactly *n* repetitions of this operation, then there are *n*^{n} different shuffles that can be performed. Of these, the number that return the deck to its original sorted order is exactly *B _{n}*. Thus, the probability that the deck is in its original order after shuffling it in this way is

*B*/

_{n}*n*

^{n}, which is significantly larger than the 1/

*n*! probability that would describe a uniformly random permutation of the deck.

Related to card shuffling are several other problems of counting special kinds of permutations that are also answered by the Bell numbers. For instance, the *n*th Bell number equals the number of permutations on *n* items in which no three values that are in sorted order have the last two of these three consecutive. In a notation for generalized permutation patterns where values that must be consecutive are written adjacent to each other, and values that can appear non-consecutively are separated by a dash, these permutations can be described as the permutations that avoid the pattern 1-23. The permutations that avoid the generalized patterns 12-3, 32-1, 3-21, 1-32, 3-12, 21-3, and 23-1 are also counted by the Bell numbers.^{[5]} The permutations in which every 321 pattern (without restriction on consecutive values) can be extended to a 3241 pattern are also counted by the Bell numbers.^{[6]} However, the Bell numbers grow too quickly to count the permutations that avoid a pattern that has not been generalized in this way: by the (now proven) Stanley–Wilf conjecture, the number of such permutations is singly exponential, and the Bell numbers have a higher asymptotic growth rate than that.

The Bell numbers can easily be calculated by creating the so-called Bell triangle, also called **Aitken's array** or the **Peirce triangle** after Alexander Aitken and Charles Sanders Peirce.^{[7]}

Here are the first five rows of the triangle constructed by these rules:

The Bell numbers appear on both the left and right sides of the triangle.

The Bell numbers satisfy a recurrence relation involving binomial coefficients:^{[8]}

A different summation formula represents each Bell number as a sum of Stirling numbers of the second kind

Spivey (2008) has given a formula that combines both of these summations:

In this formula, the summation in the middle is the general form used to define the exponential generating function for any sequence of numbers, and the formula on the right is the result of performing the summation in the specific case of the Bell numbers.

One way to derive this result uses analytic combinatorics, a style of mathematical reasoning in which sets of mathematical objects are described by formulas explaining their construction from simpler objects, and then those formulas are manipulated to derive the combinatorial properties of the objects. In the language of analytic combinatorics, a set partition may be described as a set of nonempty urns into which elements labelled from 1 to *n* have been distributed, and the combinatorial class of all partitions (for all *n*) may be expressed by the notation

This formula can be derived by expanding the exponential generating function using the Taylor series for the exponential function, and then collecting terms with the same exponent.^{[10]}
It allows *B _{n}* to be interpreted as the

*n*th moment of a Poisson distribution with expected value 1.

The *n*th Bell number is also the sum of the coefficients in the *n*th complete Bell polynomial, which expresses the *n*th moment of any probability distribution as a function of the first *n* cumulants.

The Bell numbers obey Touchard's congruence: If *p* is any prime number then^{[15]}

Because of Touchard's congruence, the Bell numbers are periodic modulo *p*, for every prime number *p*; for instance, for *p* = 2, the Bell numbers repeat the pattern odd-odd-even with period three. The period of this repetition, for an arbitrary prime number *p*, must be a divisor of

and for all prime *p* ≤ 101 and *p* = 113, 163, 167, or 173 it is exactly this number (sequence in the OEIS).^{[17]}^{[18]}

An application of Cauchy's integral formula to the exponential generating function yields the complex integral representation

Some asymptotic representations can then be derived by a standard application of the method of steepest descent.^{[19]}

The Bell numbers form a logarithmically convex sequence. Dividing them by the factorials, *B*_{n}/*n*!, gives a logarithmically concave sequence.^{[20]}^{[21]}^{[22]}

Several asymptotic formulas for the Bell numbers are known. In Berend & Tassa (2010) the following bounds were established:

Gardner (1978) raised the question of whether infinitely many Bell numbers are also prime numbers. The first few Bell numbers that are prime are:

corresponding to the indices 2, 3, 7, 13, 42 and 55 (sequence in the OEIS).

The next **Bell prime** is *B*_{2841}, which is approximately 9.30740105 × 10^{6538}.^{[25]} As of 2018, it is the largest known prime Bell number. Ignacio Larrosa Cañestro showed it was a probable prime in 2002. After 17 months of computation with Marcel Martin's ECPP program Primo, Ignacio Larrosa Cañestro proved it to be prime in 2004. He ruled out any other possible primes below *B*_{6000}, later extended to *B*_{30447} by Eric Weisstein.^{[26]} The search was extended to *B*_{50000} by Vaclav Kotesovec (05/18/2021).

The Bell numbers are named after Eric Temple Bell, who wrote about them in 1938, following up a 1934 paper in which he studied the Bell polynomials.^{[27]}^{[28]} Bell did not claim to have discovered these numbers; in his 1938 paper, he wrote that the Bell numbers "have been frequently investigated" and "have been rediscovered many times". Bell cites several earlier publications on these numbers, beginning with Dobiński (1877) which gives Dobiński's formula for the Bell numbers. Bell called these numbers "exponential numbers"; the name "Bell numbers" and the notation *B _{n}* for these numbers was given to them by Becker & Riordan (1948).

^{[29]}

The first exhaustive enumeration of set partitions appears to have occurred in medieval Japan, where (inspired by the popularity of the book *The Tale of Genji*) a parlor game called *genji-ko* sprang up,
in which guests were given five packets of incense to smell and were asked to guess which ones were the same as each other and which were different. The 52 possible solutions, counted by the Bell number *B*_{5}, were recorded by 52 different diagrams, which were printed above the chapter headings in some editions of The Tale of Genji.^{[30]}^{[31]}

In Srinivasa Ramanujan's second notebook, he investigated both Bell polynomials and Bell numbers.^{[32]}
Early references for the Bell triangle, which has the Bell numbers on both of its sides, include Peirce (1880) and Aitken (1933).