login
Tribonacci representation of 2^n, written in base 10.
2

%I #31 Jun 14 2018 10:39:16

%S 1,2,4,9,19,41,88,195,418,1033,2195,4705,10282,21850,49160,104465,

%T 223780,550294,1186344,2525345,5514438,11817057,26297040,56201282,

%U 138856076,295217708,632609378,1382640428,2974062096,6603081730,14149570820,34976354857,74361996963

%N Tribonacci representation of 2^n, written in base 10.

%H Alois P. Heinz, <a href="/A305380/b305380.txt">Table of n, a(n) for n = 0..2000</a>

%p T:= proc(n) T(n):= (<<0|1|0>, <0|0|1>, <1|1|1>>^n)[2, 3] end:

%p b:= proc(n) option remember; local j;

%p if n=0 then 0

%p else for j from 2 while T(j+1)<=n do od;

%p b(n-T(j))+2^(j-2)

%p fi

%p end:

%p a:= n-> b(2^n):

%p seq(a(n), n=0..35); # _Alois P. Heinz_, Jun 12 2018

%o (Python)

%o def A305380(n):

%o m, tlist, s = 2**n, [1,2,4], 0

%o while tlist[-1]+tlist[-2]+tlist[-3] <= m:

%o tlist.append(tlist[-1]+tlist[-2]+tlist[-3])

%o for d in tlist[::-1]:

%o s *= 2

%o if d <= m:

%o s += 1

%o m -= d

%o return s # _Chai Wah Wu_, Jun 12 2018

%Y Equals A003726(2^n).

%Y Cf. A000073, A278038, A305876.

%K nonn,base

%O 0,2

%A _N. J. A. Sloane_, Jun 12 2018

%E a(9)-a(24) from _Robert Israel_, Jun 12 2018

%E Terms a(25) and beyond from _Alois P. Heinz_, Jun 12 2018