



0, 1, 6, 4, 24, 4, 20, 12, 84, 4, 20, 12, 76, 12, 60, 36, 276, 4, 20, 12, 76, 12, 60, 36, 260, 12, 60, 36, 228, 36, 180, 108, 876, 4, 20, 12, 76, 12, 60, 36, 260, 12, 60, 36, 228, 36, 180, 108, 844, 12, 60, 36, 228, 36, 180, 108, 780, 36, 180, 108, 684, 108, 540, 324, 2724, 4
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

A169648 and A147582 agree except at these terms.


LINKS

Table of n, a(n) for n=1..64.
David Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata
N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS


FORMULA

a(1)=0, a(0)=1, a(1)=6. For n >= 2, let n = 2^k+j with 0 <= j < 2^k, and write j+1 = 2^m*(2t+1). Then a(n) = 4*(3^(m+1)2^(m+1))*3^wt(t), except if j=2^k1 we must add 2^(k+1) to the result (here wt(t) = A000120(t)).
Recurrence: a(1)=0, a(0)=1, a(1)=6. For n>=2, write n = 2^k + j, with 0 <= j < 2^k. If j+1 is a power of 2, say j+1 = 2^r, set f=j+1 if r<k, f=3(j+1) if r=k, and otherwise set f=0. Then a(n) = 3*a(j) + f. (The explicit formula in the previous line is better.)
Since there is a simple explicit formula for A147582(n), this provides a simple way to generate A169648.


EXAMPLE

Can be written in the form of a triangle:
0,
1,
6,
4,24,
4,20,12,84,
4,20,12,76,12,60,36,276,
4,20,12,76,12,60,36,260,12,60,36,228,36,180,108,876,
4,20,12,76,12,60,36,260,12,60,36,228,36,180,108,844,12,60,36,228,36,180,108,780,36,180,108,684,108,540,324,2724,
...


MAPLE

a:=proc(n) option remember; local f, j, k, t1;
if n=1 then RETURN(0); elif n=0 then RETURN(1); elif n=1 then RETURN(6);
else k:=floor(log(n)/log(2)); j:=n2^k; t1 := 2^floor(log(j+1)/log(2));
if t1=j+1 and j < 2^k1 then f := j+1 elif t1=j+1 then f := 3*(j+1) else f := 0; fi;
RETURN(3*a(j)+f);
fi;
end;
[seq(a(n), n=1..200)];


CROSSREFS

Equals A169688/4. Cf. A169697 (limit of rows).
Sequence in context: A185734 A120462 A236602 * A061592 A081631 A137174
Adjacent sequences: A169686 A169687 A169688 * A169690 A169691 A169692


KEYWORD

nonn,tabf


AUTHOR

N. J. A. Sloane, Apr 14 2010


STATUS

approved



