This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A178165 #33 Jul 06 2025 03:03:55 %S A178165 1,2,8,59,652,9736,186478,4421018,126317785,4260664251,166884941780, %T A178165 7489637988545,380861594219460,21739310882945458,1381634777325000263, %U A178165 97089956842985393297,7497783115765911443879,632884743974716421132084 %N A178165 Number of unordered collections of distinct nonempty subsets of an n-element set where each element appears in at most 2 subsets. %C A178165 If each element must appear in exactly 1 subset, then we get the Bell numbers A000110. %C A178165 If each element must appear in exactly 2 subsets, then we get A002718. %H A178165 Alois P. Heinz, <a href="/A178165/b178165.txt">Table of n, a(n) for n = 0..300</a> %F A178165 Binomial transform of A094574: a(n) = Sum_{k=0..n} C(n,k)*A094574(k). %t A178165 terms = m = 30; %t A178165 a094577[n_] := Sum[Binomial[n, k]*BellB[2n-k], {k, 0, n}]; %t A178165 egf = Exp[(1 - Exp[x])/2]*Sum[a094577[n]*(x/2)^n/n!, {n, 0, m}] + O[x]^m; %t A178165 A094574 = CoefficientList[egf + O[x]^m, x]*Range[0, m-1]!; %t A178165 a[n_] := Sum[Binomial[n, k]*A094574[[k+1]], {k, 0, n}]; %t A178165 Table[a[n], {n, 0, m-1}] (* _Jean-François Alcover_, May 24 2019 *) %o A178165 (Python) %o A178165 from numpy import array %o A178165 def toBinary(n, k): %o A178165 ans=[] %o A178165 for i in range(k): %o A178165 ans.insert(0, n%2) %o A178165 n=n>>1 %o A178165 return array(ans) %o A178165 def powerSet(k): return [toBinary(n,k) for n in range(1,2**k)] %o A178165 def courcelle(maxUses, remainingSets, exact=False): %o A178165 if exact and not all(maxUses<=sum(remainingSets)): ans=0 %o A178165 elif len(remainingSets)==0: ans=1 %o A178165 else: %o A178165 set0=remainingSets[0] %o A178165 if all(set0<=maxUses): ans=courcelle(maxUses-set0,remainingSets[1:],exact=exact) %o A178165 else: ans=0 %o A178165 ans+=courcelle(maxUses,remainingSets[1:],exact=exact) %o A178165 return ans %o A178165 for i in range(10): %o A178165 print(i, courcelle(array([2]*i),powerSet(i),exact=False)) %Y A178165 Row n=2 of A330964. %Y A178165 Cf. A094574, A000110, A002718, A178171, A178173. %K A178165 nonn %O A178165 0,2 %A A178165 _Daniel E. Loeb_, Dec 16 2010 %E A178165 Edited and corrected by _Max Alekseyev_, Dec 19 2010