|
|
A178165
|
|
Number of unordered collections of distinct nonempty subsets of an n-element set where each element appears in at most 2 subsets.
|
|
4
|
|
|
1, 2, 8, 59, 652, 9736, 186478, 4421018, 126317785, 4260664251, 166884941780, 7489637988545, 380861594219460, 21739310882945458, 1381634777325000263, 97089956842985393297, 7497783115765911443879, 632884743974716421132084
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
If each element must appear in exactly 1 subset, then we get the Bell numbers A000110.
If each element must appear in exactly 2 subsets, then we get A002718.
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
terms = m = 30;
a094577[n_] := Sum[Binomial[n, k]*BellB[2n-k], {k, 0, n}];
egf = Exp[(1 - Exp[x])/2]*Sum[a094577[n]*(x/2)^n/n!, {n, 0, m}] + O[x]^m;
A094574 = CoefficientList[egf + O[x]^m, x]*Range[0, m-1]!;
a[n_] := Sum[Binomial[n, k]*A094574[[k+1]], {k, 0, n}];
|
|
PROG
|
(Python)
def powerSet(k): return [toBinary(n, k) for n in range(1, 2**k)]
def courcelle(maxUses, remainingSets, exact=False):
if exact and not all(maxUses<=sum(remainingSets)): ans=0
elif len(remainingSets)==0: ans=1
else:
set0=remainingSets[0]
if all(set0<=maxUses): ans=courcelle(maxUses-set0, remainingSets[1:], exact=exact)
else: ans=0
ans+=courcelle(maxUses, remainingSets[1:], exact=exact)
return ans
for i in range(10):
print(i, courcelle(array([2]*i), powerSet(i), exact=False))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|