%I #13 Dec 26 2021 05:29:48
%S 0,1,2,4,-1,4,8,-4,1,8,-2,8,-1,8,16,-8,1,16,-8,2,16,-8,4,-1,16,-4,16,
%T -4,1,16,-2,16,-1,16,32,-16,1,32,-16,2,32,-16,4,-1,32,-16,4,32,-16,8,
%U -4,1,32,-16,8,-2,32,-16,8,-1,32,-8,32,-8,1,32,-8,2,32
%N R(k), the minimal alternating binary representation of k, concatenated for k = 0, 1, 2,....
%C Suppose that b = (b(0), b(1), ... ) is an increasing sequence of positive integers satisfying b(0) = 1 and b(n+1) <= 2*b(n) for n >= 0. Let B(n) be the least b(m) >= n. Let R(0) = 1, and for n > 0, let R(n) = B(n) - R(B(n) - n). The resulting sum of the form R(n) = B(n) - B(m(1)) + B(m(2)) - ... + ((-1)^k)*B(k) is the minimal alternating b-representation of n. The sum B(n) + B(m(2)) + ... is the positive part of R(n), and the sum B(m(1)) + B(m(3)) + ... , the nonpositive part of R(n). The number ((-1)^k)*B(k) is the trace of n.
%C If b(n) = 2^n, the sum R(n) is the minimal alternating binary representation of n.
%C A055975 = trace of n, for n >= 1.
%C A091072 gives the numbers having positive trace.
%C A091067 gives the numbers having negative trace.
%C A072339 = number of terms in R(n).
%C A073122 = sum of absolute values of the terms in R(n).
%D D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1981, Vol. 2 (2nd ed.), p. 196, Exercise 27.
%H Clark Kimberling, <a href="/A256696/b256696.txt">Table of n, a(n) for n = 0..1000</a>
%e R(0) = 0
%e R(1) = 1
%e R(2) = 2
%e R(3) = 4 - 1
%e R(4) = 4
%e R(9) = 8 - 4 + 1
%e R(11) = 16 - 8 + 4 - 1
%t z = 100; b[n_] := 2^n; bb = Table[b[n], {n, 0, 40}];
%t s[n_] := Table[b[n + 1], {k, 1, b[n]}];
%t h[0] = {1}; h[n_] := Join[h[n - 1], s[n - 1]];
%t g = h[10]; r[0] = {0};
%t r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]]
%t u = Flatten[Table[r[n], {n, 0, z}]]
%Y Cf. A000079, A256655 (Fibonacci based), A055975, A091072, A091067, A072339, A073122, A256701, A256702.
%K easy,sign,base
%O 0,3
%A _Clark Kimberling_, Apr 09 2015