A367222 Number of subsets of {1..n} whose cardinality can be written as a nonnegative linear combination of the elements.
1, 2, 3, 6, 12, 24, 49, 101, 207, 422, 859, 1747, 3548, 7194, 14565, 29452, 59496, 120086, 242185, 488035, 982672, 1977166, 3975508, 7989147, 16047464, 32221270, 64674453, 129775774, 260337978, 522124197, 1046911594, 2098709858, 4206361369, 8429033614, 16887728757, 33829251009, 67755866536, 135687781793, 271693909435
Offset: 0
Keywords
Examples
The set {1,2,4} has 3 = (2)+(1) or 3 = (1+1+1) so is counted under a(4). The a(0) = 1 through a(4) = 12 subsets: {} {} {} {} {} {1} {1} {1} {1} {1,2} {1,2} {1,2} {1,3} {1,3} {2,3} {1,4} {1,2,3} {2,3} {2,4} {1,2,3} {1,2,4} {1,3,4} {2,3,4} {1,2,3,4}
Crossrefs
The following sequences count and rank integer partitions and finite sets according to whether their length is a subset-sum or linear combination of the parts. The current sequence is starred.
sum-full sum-free comb-full comb-free
-------------------------------------------
A326020 counts complete subsets.
Triangles:
A365541 counts subsets containing two distinct elements summing to k.
Programs
-
Mathematica
combs[n_,y_]:=With[{s=Table[{k,i},{k,y}, {i,0,Floor[n/k]}]}, Select[Tuples[s], Total[Times@@@#]==n&]]; Table[Length[Select[Subsets[Range[n]], combs[Length[#], Union[#]]!={}&]], {n,0,10}]
-
Python
from itertools import combinations from sympy.utilities.iterables import partitions def A367222(n): c, mlist = 1, [] for m in range(1,n+1): t = set() for p in partitions(m): t.add(tuple(sorted(p.keys()))) mlist.append([set(d) for d in t]) for k in range(1,n+1): for w in combinations(range(1,n+1),k): ws = set(w) for s in mlist[k-1]: if s <= ws: c += 1 break return c # Chai Wah Wu, Nov 16 2023
Formula
a(n) = 2^n - A367223(n).
Extensions
a(13)-a(33) from Chai Wah Wu, Nov 15 2023
a(34)-a(38) from Max Alekseyev, Feb 25 2025