I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
this unit 0.62
sub units 3.54

bell numbers list

Returns the Bell numbers of order 0 to n.
Controller: CodeCogs

get GPL add to cart





Bell Numbers List

std::vector<int>bell_numbers_listintn )
The Bell number B(n) is defined as the number of partitions (of any size) of a set into n distinguishable objects.

It is also the number of restricted growth functions on n. Note that the Stirling numbers of the second kind, S^m_n, count the number of partitions of n objects into m classes, and so it is true that

For example, there are 15 partitions of a set of 4 objects:

and so B(4) = 15. The recurrence relation used with this function to calculate the Bell number of order i is as follows:

where i takes values from 0 to n.


SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

Example 1

#include <codecogs/maths/combinatorics/sequences/bell_numbers_list.h>
#include <iostream>
int main() {
  std::vector<int> result = Maths::Combinatorics::Sequences::bell_numbers_list(5);
  std::cout << "Number of values: " << result.size() << std::endl;
  for (int i = 0; i < result.size(); i++)
    std::cout << result[i] << "  ";
  std::cout << std::endl;
  return 0;
Number of values: 6
1  1  2  5  15  52


nthe maximum value of the index in the generated Bell sequence


the Bell numbers of order 0 to n


Lucian Bentea (August 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.