OFFSET
0,2
COMMENTS
More informally, any number n encodes a finite sets of positive numbers, say { e_1, e_2, ..., e_h }, and a(n) gives the number of distinct values of the form +- e_1 +- e_2 ... +- e_h.
The set of exponents in expression for n as a sum of distinct powers of 2 corresponds to the n-th row of A133457.
A number n belongs to A293576 iff a(n) is odd.
a(n) <= 2^A000120(n) for any n >= 0.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
EXAMPLE
For n = 15:
- E_15 = { 1, 2, 3, 4 },
- the possible "plus-minus" sums are:
+4 +3 +2 +1 = 10 (1st value)
+4 +3 +2 -1 = 8 (2nd value)
+4 +3 -2 +1 = 6 (3rd value)
+4 +3 -2 -1 = 4 (4th value)
+4 -3 +2 +1 = 4 (already seen)
+4 -3 +2 -1 = 2 (5th value)
+4 -3 -2 +1 = 0 (6th value)
+4 -3 -2 -1 = -2 (7th value)
-4 +3 +2 +1 = 2 (already seen)
-4 +3 +2 -1 = 0 (already seen)
-4 +3 -2 +1 = -2 (already seen)
-4 +3 -2 -1 = -4 (8th value)
-4 -3 +2 +1 = -4 (already seen)
-4 -3 +2 -1 = -6 (9th value)
-4 -3 -2 +1 = -8 (10th value)
-4 -3 -2 -1 = -10 (11th value)
- hence, a(15) = 11.
PROG
(PARI) a(n) = { my (v=Set(0)); my (b = Vecrev(binary(n))); for (i=1, #b, if (b[i], v = setunion(Set(vector(#v, k, v[k]-i)), Set(vector(#v, k, v[k]+i))); ); ); return (#v); }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 14 2017
STATUS
approved