Bell numbers: Difference between revisions

m
Reverted edits by Gerard Schildberger (talk) to last revision by Peak
m (changed section header name.)
m (Reverted edits by Gerard Schildberger (talk) to last revision by Peak)
Line 1:
{{task}}
 
[[wp:Bell number|Bell or exponential numbers]] are enumerations of the number of different ways to partition a set that has exactly &nbsp;'''n''' elements. Each element of the sequence '''B<sub>n</sub>''' &nbsp;is the number of partitions of a set of size '''n''' where order of the elements and order of the partitions are non-significant. E.G.: '''{a b}''' is the same as '''{b a}''' and '''{a} {b}''' is the same as '''{b} {a}'''.
 
Each element of the sequence &nbsp; '''B<sub>n</sub>''' &nbsp; is the number of partitions of a set of size &nbsp; '''n''' &nbsp; where order of the elements and order of the partitions are non-significant.
 
;So:
 
: &nbsp; '''B<sub>0</sub> = 1''' &nbsp; trivially. &nbsp; There is only one way to partition a set with zero elements: &nbsp; . '''{ }'''
;E.G.:
: &nbsp;&nbsp; '''{a b}''' &nbsp; &nbsp; is the same as &nbsp; '''{b a}''', &nbsp; &nbsp; and
: &nbsp; '''{a} {b}''' &nbsp; is the same as &nbsp; '''{b} {a}'''.
 
: &nbsp; '''B<sub>1</sub> = 1''' &nbsp; There is only one way to partition a set with one element: &nbsp; &nbsp;. '''{a}'''
 
: &nbsp; '''B<sub>2</sub> = 2''' &nbsp; Two elements may be partitioned in two ways: &nbsp; &nbsp; . '''{a} {b}, &nbsp; &nbsp; {a b}'''
;Examples:
: &nbsp; '''B<sub>0</sub> = 1''' &nbsp; trivially. &nbsp; There is only one way to partition a set with zero elements: &nbsp; '''{ }'''
: &nbsp; '''B<sub>1</sub> = 1''' &nbsp; There is only one way to partition a set with one element: &nbsp; &nbsp; '''{a}'''
: &nbsp; '''B<sub>2</sub> = 2''' &nbsp; Two elements may be partitioned in two ways: &nbsp; &nbsp; '''{a} {b}, &nbsp; &nbsp; {a b}'''
: &nbsp; '''B<sub>3</sub> = 5''' &nbsp; Three elements may be partitioned in five ways: &nbsp; &nbsp; '''{a} {b} {c}, &nbsp; &nbsp; {a b} {c}, &nbsp; &nbsp; {a} {b c}, &nbsp; &nbsp; {a c} {b}, &nbsp; &nbsp; {a b c}'''
: &nbsp; and so on.
 
: &nbsp; '''B<sub>3</sub> = 5''' &nbsp; Three elements may be partitioned in five ways: &nbsp; &nbsp; '''{a} {b} {c}, &nbsp; &nbsp; {a b} {c}, &nbsp; &nbsp; {a} {b c}, &nbsp; &nbsp; {a c} {b}, &nbsp; &nbsp; {a b c}'''
 
: &nbsp; and so on.
A simple way to find the Bell numbers is construct a '''[[wp:Bell_triangle|Bell triangle]]''', &nbsp; also known as an '''Aitken's array''' &nbsp; or &nbsp; '''Peirce triangle''', &nbsp; and read off the numbers in the first column of each row.
 
 
There are other generating algorithms though, &nbsp; and you are free to choose the best/most appropriate for your case.
A simple way to find the Bell numbers is construct a '''[[wp:Bell_triangle|Bell triangle]]''', &nbsp; also known as an '''Aitken's array''' &nbsp; or &nbsp; '''Peirce triangle''', &nbsp; and read off the numbers in the first column of each row. There are other generating algorithms though, and you are free to choose the best / most appropriate for your case.
 
 
;Task:
Write a routine (function, generator, whatever) to generate the Bell number sequence and call the routine to show here, &nbsp; on this page at least the '''first 15''' and (if your language supports big Integers) &nbsp; '''50th''' &nbsp; elements of the sequence.
 
Write a routine (function, generator, whatever) to generate the Bell number sequence and call the routine to show here, &nbsp; on this page at least the '''first 15''' and (if your language supports big Integers) &nbsp; '''50th''' &nbsp; elements of the sequence.
If you ''do'' use the Bell triangle method to generate the numbers, &nbsp; also show the '''first ten rows''' of the Bell triangle.
 
If you ''do'' use the Bell triangle method to generate the numbers, &nbsp; also show the '''first ten rows''' of the Bell triangle.
 
 
;See also:
 
:* &nbsp; '''[[OEIS:A000110|OEIS:A000110 Bell or exponential numbers]]'''
:* &nbsp; '''[[OSISoeis:A011971A000110|OEIS:A011971A000110 Aitken'sBell or exponential arraynumbers]]'''
:* '''[[oeis:A011971|OEIS:A011971 Aitken's array]]'''
<br><br>
 
=={{header|Ada}}==
10,327

edits