OFFSET
0,2
COMMENTS
Also the number of subsets of [n] avoiding distance (i+1) between elements if the i-th bit is set in the binary representation of n. a(6) = 17: {}, {1}, {2}, {3}, {4}, {5}, {6}, {1,2}, {1,5}, {1,6}, {2,3}, {2,6}, {3,4}, {4,5}, {5,6}, {1,2,6}, {1,5,6}.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1023
FORMULA
a(2^n-1) = A376697(n).
EXAMPLE
a(6) = 17: 000000, 000001, 000010, 000011, 000100, 000110, 001000, 001100, 010000, 010001, 011000, 100000, 100001, 100010, 100011, 110000, 110001 because 6 = 110_2 and no two "1" digits have distance 2 or 3.
MAPLE
h:= proc(n) option remember; `if`(n=0, 1, 2^(1+ilog2(n))) end:
b:= proc(n, k, t) option remember; `if`(n=0, 1, add(`if`(j=1 and
Bits[And](t, k)>0, 0, b(n-1, k, irem(2*t+j, h(k)))), j=0..1))
end:
a:= n-> b(n$2, 0):
seq(a(n), n=0..50);
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alois P. Heinz, Sep 09 2024
STATUS
approved