OFFSET
0,3
COMMENTS
An ordered set partition of {1..n} is a sequence (B_1,...,B_k) of nonempty disjoint subsets whose union is {1..n}. If s(B) = Sum_{x in B} x, then a(n) counts those partitions for which the values s(B_i) are pairwise distinct.
Equivalently, this counts ordered set partitions for which the map B -> s(B) is injective.
This is a refinement of the Fubini numbers A000670 obtained by imposing an additive distinctness constraint on block sums. Let T(n,k) be the number of set partitions of {1..n} into k blocks with pairwise distinct block sums; then a(n) = Sum_{k=0..n} k!*T(n,k). This can be viewed as counting ordered set partitions avoiding collisions among block sums.
FORMULA
EXAMPLE
For n = 3, there are 13 ordered set partitions; the only ones with equal block sums are 12|3 and 3|12, hence a(3) = 11.
For n = 4, T(4,1)=1, T(4,2)=6, T(4,3)=4, T(4,4)=1, hence a(4) = 1!*1 + 2!*6 + 3!*4 + 4!*1 = 61.
PROG
(Python)
from functools import lru_cache
def a(n):
subsum = [0] * (1 << n)
for mask in range(1, 1 << n):
b = mask & -mask
subsum[mask] = subsum[mask ^ b] + b.bit_length()
@lru_cache(None)
def F(mask, used):
if mask == 0:
return 1
total = 0
sub = mask
while sub:
s = subsum[sub]
if s not in used:
total += F(mask ^ sub, used + (s, ))
sub = (sub - 1) & mask
return total
return F((1 << n) - 1, ())
CROSSREFS
KEYWORD
nonn
AUTHOR
Pablo Cadena-UrzĂșa, Apr 20 2026
EXTENSIONS
a(16) from Alois P. Heinz, Apr 21 2026
a(17)-a(21) from Christian Sievers, Apr 26 2026
STATUS
approved
