OFFSET
0,4
COMMENTS
Two integers are binary carry-connected if their bitwise AND is not zero.
For n = 0 the carry-connected subset is the empty set.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1024
Wikipedia, Bitwise operation
Wikipedia, Partition of a set
FORMULA
MAPLE
h:= proc(n, s) local i, m; m:= n;
for i in s do m:= Bits[Or](m, i) od; {m}
end:
g:= (n, s)-> (w-> `if`(w={}, s union {n}, s minus w union
h(n, w)))(select(x-> Bits[And](n, x)>0, s)):
b:= proc(n, s) option remember; `if`(n=0,
`if`(nops(s)>1, 0, 1), b(n-1, s)+b(n-1, g(n, s)))
end:
a:= n-> `if`(n=0, 1, b(n-1, {n})):
seq(a(n), n=0..42);
MATHEMATICA
h[n_, s_] := Module[{i, m = n}, Do[m = BitOr[m, i], {i, s}]; {m}];
g[n_, s_] := Function[w, If[w == {}, s ~Union~ {n}, s ~Complement~ w ~Union~ h[n, w]]][Select[s, BitAnd[n, #] > 0&]];
b[n_, s_] := b[n, s] = If[n == 0, If[Length[s] > 1, 0, 1], b[n - 1, s] + b[n - 1, g[n, s]]];
a[n_] := If[n == 0, 1, b[n - 1, {n}]];
a /@ Range[0, 42] (* Jean-François Alcover, May 10 2020, after Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Mar 31 2019
STATUS
approved