In number theory and enumerative combinatorics, the ordered Bell numbers or Fubini numbers count the number of weak orderings on a set of elements. Weak orderings arrange their elements into a sequence allowing ties, such as might arise as the outcome of a horse race). Starting from , these numbers are
The ordered Bell numbers may be computed via a summation formula involving binomial coefficients, or by using a recurrence relation. Along with the weak orderings, they count several other types of combinatorial objects that have a bijective correspondence to the weak orderings, such as the ordered multiplicative partitions of a squarefree number or the faces of all dimensions of a permutohedron.
The ordered Bell numbers appear in the work of Cayley (1859), who used them to count certain plane trees with totally ordered leaves. In the trees considered by Cayley, each root-to-leaf path has the same length, and the number of nodes at distance from the root must be strictly smaller than the number of nodes at distance , until reaching the leaves. In such a tree, there are pairs of adjacent leaves, that may be weakly ordered by the height of their lowest common ancestor; this weak ordering determines the tree. Mor & Fraenkel (1984) call the trees of this type "Cayley trees", and they call the sequences that may be used to label their gaps (sequences of positive integers that include at least one copy of each positive integer between one and the maximum value in the sequence) "Cayley permutations".
Pippenger (2010) traces the problem of counting weak orderings, which has the same sequence as its solution, to the work of Whitworth (1886). These numbers were called Fubini numbers by Louis Comtet, because they count the number of different ways to rearrange the ordering of sums or integrals in Fubini's theorem, which in turn is named after Guido Fubini. The Bell numbers, named after Eric Temple Bell, count the number of partitions of a set, and the weak orderings that are counted by the ordered Bell numbers may be interpreted as a partition together with a total order on the sets in the partition.
The th ordered Bell number may be given by a summation formula involving the Stirling numbers of the second kind, which count the number of partitions of an -element set into nonempty subsets. A weak ordering may be described as a permutation of the subsets in this partition, and so the ordered Bell numbers (the number of weak orderings) may be calculated by summing these numbers, multiplied by a factorial, , that counts the number of these permutations: 
The same summation may be expanded out into a double summation involving binomial coefficients (using a formula expressing Stirling numbers as a sum of binomial coefficients), or given by an infinite series:
Another summation formula expresses the ordered Bell numbers in terms of the Eulerian numbers, which count the number of permutations of items with runs of increasing items:
The exponential generating function of the ordered Bell numbers is
As well as the formulae above, the ordered Bell numbers may be calculated by the recurrence relation
The intuitive meaning of this formula is that a weak ordering on items may be broken down into a choice of some nonempty set of items that go into the first equivalence class of the ordering, together with a smaller weak ordering on the remaining items. As a base case for the recurrence, (there is one weak ordering on zero items). Based on this recurrence, these numbers can be shown to obey certain periodic patterns in modular arithmetic: for sufficiently large ,
Several additional modular identities are given by Good (1975) and Poonen (1988).
As has already been mentioned, the ordered Bell numbers count weak orderings, permutohedron faces, Cayley trees, Cayley permutations, ordered multiplicative partitions of squarefree numbers, and equivalent formulae in Fubini's theorem. Weak orderings in turn have many other applications. For instance, in horse racing, photo finishes have eliminated most but not all ties, called in this context dead heats, and the outcome of a race that may contain ties (including all the horses, not just the first three finishers) may be described using a weak ordering. For this reason, the ordered Bell numbers count the possible number of outcomes of a horse race, or the possible outcomes of a multi-candidate election. In contrast, when items are ordered or ranked in a way that does not allow ties (such as occurs with the ordering of cards in a deck of cards, or batting orders among baseball players), the number of orderings for items is a factorial number , which is significantly smaller than the corresponding ordered Bell number.
Kemeny (1956) uses the ordered Bell numbers to describe the "complexity" of an n-ary relation, by which he means the number of other relations one can form from it by permuting and repeating its arguments (lowering the arity with every repetition). In this application, for each derived relation, the arguments of the original relation are weakly ordered by the positions of the corresponding arguments of the derived relation.
Velleman & Call (1995) consider combination locks with a numeric keypad, in which several keys may be pressed simultaneously and a combination consists of a sequence of keypresses that includes each key exactly once. As they show, the number of different combinations in such a system is given by the ordered Bell numbers.
Ellison & Klein (2001) point out an application of these numbers to optimality theory in linguistics. In this theory, grammars for natural languages are constructed by ranking certain constraints, and (in a phenomenon called factorial typology) the number of different grammars that can be formed in this way is limited to the number of permutations of the constraints. A paper reviewed by Ellison and Klein suggested an extension of this linguistic model in which ties between constraints are allowed, so that the ranking of constraints becomes a weak order rather than a total order. As they point out, the much larger magnitude of the ordered Bell numbers, relative to the corresponding factorials, allows this theory to generate a much richer set of grammars.