%I #27 Feb 13 2022 23:16:55
%S 0,1,1,2,1,2,3,3,1,2,3,3,3,5,6,4,1,2,3,3,3,5,6,4,3,5,6,6,8,11,10,5,1,
%T 2,3,3,3,5,6,4,3,5,6,6,8,11,10,5,3,5,6,6,8,11,10,7,8,11,12,14,19,21,
%U 15,6,1,2,3,3,3,5,6,4,3,5,6,6,8,11,10,5,3,5,6,6,8,11,10,7,8,11,12,14,19,21,15
%N a(0)=0, a(1)=1; a(2^i+j) = a(j) + a(j+1) for 0 <= j < 2^i.
%C The original definition from _Gary W. Adamson_: Iterative sequence in 2^n subsets generated from binomial transform operations. Let S = a string s(1) through s(2^n); and B = appended string. Say S = (1, 1, 2, 1). Perform the binomial transform operation on S as a vector: [1, 1, 2, 1, 0, 0, 0, ...] = 1, 2, 5, 11, 21, 36, ... Then, performing the analogous operation on B gives a truncated version of the previous sequence: (2, 5, 11, 21, ...). Given a subset s(1) through s(2^n), say s(1), ..., s(4) = (a,b,c,d). Use the operation ((a+b), (b+c), (c+d), d) and append the result to the right of the previous string. Perform the next operation on s(1) through s(2^(n+1)). s(1), ..., s(4) = (1, 1, 2, 1). The operation gives ((1+1), (1+2), (2+1), (1)) = (2, 3, 3, 1) which we append to (1, 1, 2, 1), giving s(1) through s(8): (1, 1, 2, 1, 2, 3, 3, 1).
%H N. J. A. Sloane, <a href="/A118977/b118977.txt">Table of n, a(n) for n = 0..9999</a>
%H David Applegate, Omar E. Pol and N. J. A. Sloane, <a href="/A000695/a000695_1.pdf">The Toothpick Sequence and Other Sequences from Cellular Automata</a>, Congressus Numerantium, Vol. 206 (2010), 157-191. [There is a typo in Theorem 6: (13) should read u(n) = 4.3^(wt(n-1)-1) for n >= 2.]
%H N. J. A. Sloane, <a href="/wiki/Catalog_of_Toothpick_and_CA_Sequences_in_OEIS">Catalog of Toothpick and Cellular Automata Sequences in the OEIS</a>
%F a(0)=0; a(2^i)=1. For n >= 3 let n = 2^i + j, where 1 <= j < 2^i. Then a(n) = Sum_{k >= 0} binomial( wt(j+k),k ), where wt() = A000120(). - _N. J. A. Sloane_, Jun 01 2009
%F G.f.: ( x + x^2 * Product_{ n >= 0} (1 + x^(2^n-1) + x^(2^n)) ) / (1+x). - _N. J. A. Sloane_, Jun 08 2009
%e From _N. J. A. Sloane_, Jun 01 2009: (Start)
%e Has a natural structure as a triangle:
%e 0,
%e 1,
%e 1,2,
%e 1,2,3,3,
%e 1,2,3,3,3,5,6,4,
%e 1,2,3,3,3,5,6,4,3,5,6,6,8,11,10,5,
%e 1,2,3,3,3,5,6,4,3,5,6,6,8,11,10,5,3,5,6,6,8,11,10,7,8,11,12,14,19,21,15,6,
%e 1,2,3,3,3,5,6,4,3,5,...
%e In this form the rows converge to (1 followed by A160573) or A151687.
%p Maple code for the rows of the triangle (PP(n) is a g.f. for the (n+1)-st row):
%p g:=n->1+x^(2^n-1)+x^(2^n);
%p c:=n->x^(2^n-1)*(1-x^(2^n));
%p PP:=proc(n) option remember; global g,c;
%p if n=1 then 1+2*x else series(g(n-1)*PP(n-1)-c(n-1),x,10000); fi; end; # _N. J. A. Sloane_, Jun 01 2009
%t a[0] = 0; a[1] = 1; a[n_] := a[n] = (j = n - 2^Floor[Log[2, n]]; a[j] + a[j + 1]); Array[a, 95, 0] (* _Jean-François Alcover_, Nov 10 2016 *)
%Y For the recurrence a(2^i+j) = C*a(j) + D*a(j+1), a(0) = A, a(1) = B for following values of (A B C D) see: (0 1 1 1) A118977, (1 0 1 1) A151702, (1 1 1 1) A151570, (1 2 1 1) A151571, (0 1 1 2) A151572, (1 0 1 2) A151703, (1 1 1 2) A151573, (1 2 1 2) A151574, (0 1 2 1) A160552, (1 0 2 1) A151704, (1 1 2 1) A151568, (1 2 2 1) A151569, (0 1 2 2) A151705, (1 0 2 2) A151706, (1 1 2 2) A151707, (1 2 2 2) A151708.
%Y Cf. A160552, A151568, A151569, A151570, A160573, A139250. - _N. J. A. Sloane_, May 25 2009
%Y Cf. A163267 (partial sums). - _N. J. A. Sloane_, Jan 07 2010
%K nonn
%O 0,4
%A _Gary W. Adamson_, May 07 2006
%E New definition and more terms from _N. J. A. Sloane_, May 25 2009