Wolfram Research

Function Repository Resource:

FubiniNumber

Source Notebook

Count the number of ways to partition a set where the order of the subsets matters

Contributed by: George Beck

ResourceFunction["FubiniNumber"][set]

counts the number of ways to partition set into subsets, where the order of the subsets matters.

Examples

Basic Examples

The simplest non-trivial Fubini number:

In[1]:=
ResourceFunction["FubiniNumber"][2]
Out[1]=

Here are the first 10 Fubini numbers:

In[2]:=
ResourceFunction["FubiniNumber"] /@ Range[10]
Out[2]=

Scope

This shows the 13 ordered set partitions of the the set {1,2,3}:

In[3]:=
partitions = Apply[Join, Permutations /@ ResourceFunction[
ResourceObject[
Association[
       "Name" -> "SetPartitions", "UUID" -> "23cfd32b-8215-488e-875f-44585e164f6a", "ResourceType" -> "Function", "Version" -> "2.0.0", "Description" -> "Gives all possible ways to partition a set \
into blocks, ignoring order of blocks and within blocks", "RepositoryLocation" -> URL[
         "https://www.wolframcloud.com/objects/resourcesystem/api/1.\
0"], "WolframLanguageVersionRequired" -> "11.3", "SymbolName" -> "FunctionRepository`$\
4fc60841588b465482489bc11dd61cc4`SetPartitions", "FunctionLocation" -> CloudObject[
         "https://www.wolframcloud.com/objects/b590d787-71e7-4b7f-\
90b3-beeadf0fb19e"], "ShortName" -> "SetPartitions"], {
       ResourceSystemBase -> Automatic}]][{1, 2, 3}]];
% // Column
Out[4]=
In[5]:=
Length@partitions
Out[5]=

This accords with:

In[6]:=
ResourceFunction["FubiniNumber"][3]
Out[6]=

Neat Examples

The Fubini numbers are periodic mod 10:

In[7]:=
ListLinePlot@
 Table[Mod[ResourceFunction["FubiniNumber"][n], 10], {n, 20}]
Out[7]=

There are many other modular relations:

In[8]:=
ListLinePlot@
 Table[Mod[ResourceFunction["FubiniNumber"][n], 11], {n, 20}]
Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information