OFFSET
1,2
COMMENTS
More informally, this sequence encodes finite sets of positive numbers, say { e_1, e_2, ..., e_h }, such that +- e_1 +- e_2 ... +- e_h = 0 has a solution.
The set of exponents in expression for n as a sum of distinct powers of 2 corresponds to the n-th row of A133457.
No term can have a Hamming weight of 1 or 2.
If x and y belong to this sequence and x AND y = 0 (where AND stands for the bitwise and-operator), then x + y belongs to this sequence.
If k has an odd Hamming weight, then there are only a finite number of terms with the same odd part as k (see A000265 for the odd part of a number).
The number 2^k-1 belongs to this sequence iff A063865(k) > 0.
If k has Hamming weight > 1, then k + 2^(A029931(k)-1) belongs to this sequence.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
EXAMPLE
2*42 = 2^6 + 2^4 + 2^2 and 6 = 4 + 2, hence 42 appears in the sequence.
2*11 = 2^4 + 2^2 + 2^1 and { 1, 2, 4 } cannot be partitioned into two parts with equals sums, hence 11 does not appear in the sequence.
MAPLE
b:= proc(n, t) option remember; `if`(n=0, is(t=0),
(i-> b(n-2^i, t-i) or b(n-2^i, t+i))(ilog2(n)))
end:
a:= proc(n) option remember; local k; for k from 1+
`if`(n=1, -1, a(n-1)) while not b(2*k, 0) do od; k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Oct 22 2017
PROG
(PARI) is(n) = { my (v=Set(0)); my (b = Vecrev(binary(n))); for (i=1, #b, if (b[i], v = set union(Set(vector(#v, k, v[k]-i)), Set(vector(#v, k, v[k]+i))); ); ); return (set search(v, 0)); }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 12 2017
STATUS
approved