login
a(0) = 1, a(1) = 1; a(2^i + j) = 3a(j) + a(j + 1) for 0 <= j < 2^i.
1

%I #12 Feb 24 2021 02:48:19

%S 1,1,4,7,4,7,19,25,4,7,19,25,19,40,82,79,4,7,19,25,19,40,82,79,19,40,

%T 82,94,97,202,325,241,4,7,19,25,19,40,82,79,19,40,82,94,97,202,325,

%U 241,19,40,82,94,97,202,325,256,97,202,340,379,493,931,1216,727,4,7,19,25,19,40

%N a(0) = 1, a(1) = 1; a(2^i + j) = 3a(j) + a(j + 1) for 0 <= j < 2^i.

%H Robert Israel, <a href="/A170863/b170863.txt">Table of n, a(n) for n = 0..10000</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>

%p f:= proc(n) option remember;

%p local j;

%p j:= n - 2^ilog2(n);

%p 3*procname(j) + procname(j+1)

%p end proc:

%p f(0):= 1: f(1):= 1:

%p map(f, [$0..100]); # _Robert Israel_, Jul 10 2020

%t f[n_] := f[n] = With[{j = n - 2^Floor@Log[2, n]}, 3 f[j] + f[j+1]];

%t f[0] = f[1] = 1;

%t f /@ Range[0, 100] (* _Jean-François Alcover_, Aug 31 2020, after _Robert Israel_ *)

%K nonn,look

%O 0,3

%A _N. J. A. Sloane_, Jan 02 2010