%I #40 Oct 06 2022 03:14:27
%S 0,1,1,3,1,3,5,7,1,3,5,7,5,11,17,15,1,3,5,7,5,11,17,15,5,11,17,19,21,
%T 39,49,31,1,3,5,7,5,11,17,15,5,11,17,19,21,39,49,31,5,11,17,19,21,39,
%U 49,35,21,39,53,59,81,127,129,63,1,3,5,7,5,11,17,15,5,11,17,19,21,39,49,31
%N a(0)=0, a(1)=1; a(2^i+j) = 2*a(j) + a(j+1) for 0 <= j < 2^i.
%C This recurrence is patterned after the one for A152980, but without the special cases.
%C Sequence viewed as triangle:
%C 0,
%C 1,
%C 1, 3,
%C 1, 3, 5, 7,
%C 1, 3, 5, 7, 5, 11, 17, 15,
%C 1, 3, 5, 7, 5, 11, 17, 15, 5, 11, 17, 19, 21, 39, 49, 31.
%C The rows converge to A151548.
%C Also the sum of the terms in the k-th row (k >= 1) is 4^(k-1). Proof by induction. - _N. J. A. Sloane_, Jan 21 2010
%C If this sequence [1, 1, 3, 1, 3, 5, 7, 1, 3, 5, 7, 5, 11, 17, 15, ...] is convolved with [1, 2, 2, 2, 2, 2, 2, ...] we obtain A139250, the toothpick sequence. Example: A139250(5) = 15 = (1, 2, 2, 2, 2) * (3, 1, 3, 1, 1). - _Gary W. Adamson_, May 19 2009
%C Starting with 1 and convolved with [1, 2, 0, 0, 0, ...] = A151548. - _Gary W. Adamson_, Jun 04 2009
%C Refer to A162956 for the analogous triangle using N=3. - _Gary W. Adamson_, Jul 20 2009
%C It appears that the sums of two successive terms give the positive terms of A139251. - _Omar E. Pol_, Feb 18 2015
%H N. J. A. Sloane, <a href="/A160552/b160552.txt">Table of n, a(n) for n = 0..16384</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 G.f.: x*(1+2*x)/(1+x) + (4*x^2/(1+2*x))*(-1 + Product_{k>=1} (1 + x^(2^k-1) + 2*x^(2^k))). - _N. J. A. Sloane_, May 23 2009, based on _Gary W. Adamson_'s comment above and the known g.f. for A139250.
%F It appears that a(n) = A169708(n)/4, n >= 1. - _Omar E. Pol_, Feb 15 2015
%F It appears that a(n) = A139251(n) - a(n-1), n >= 1. - _Omar E. Pol_, Feb 18 2015
%e a(2) = a(2^1+0) = 2*a(0) + a(1) = 1, a(3) = a(2^1+1) = 2*a(1) + a(2) = 3*a(2^i) = 2*a(0) + a(1) = 1.
%p S:=proc(n) option remember; local i,j; if n <= 1 then RETURN(n); fi; i:=floor(log(n)/log(2)); j:=n-2^i; 2*S(j)+S(j+1); end; # _N. J. A. Sloane_, May 18 2009
%p H := x*(1+2*x)/(1+x) + (4*x^2/(1+2*x))*(mul(1+x^(2^k-1)+2*x^(2^k),k=1..20)-1); series(H,x,120); # _N. J. A. Sloane_, May 23 2009
%t Nest[Join[#, 2 # + Append[Rest@#, 1]] &, {0}, 7] (* _Ivan Neretin_, Feb 09 2017 *)
%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. A152980, A139250, A139251, A151548, A160570, A151568.
%Y Cf. A162956, A170903.
%K nonn
%O 0,4
%A _David Applegate_, May 18 2009