%I #27 Sep 29 2013 06:27:34
%S 0,1,2,4,3,4,7,12,5,6,7,12,11,12,20,33,8,9,10,17,11,12,20,33,18,19,20,
%T 33,32,33,54,88,13,14,15,25,16,17,28,46,18,19,20,33,32,33,54,88,29,30,
%U 31,51,32,33,54,88,52,53,54,88,87,88,143,232,21,22,23,38,24,25,41
%N Replace all '11' => '101' in the binary representation of n, treat the result as representation of a(n) in base of Fibonacci numbers (A014417).
%C Index of r in A014417, where r = ReplaceAll('11' -> '101' in bin(n)).
%e Base 2 representation of 14 is 1110, that is 101010 after the replacement, that is A014417(20), so a(14)=20.
%o (Python)
%o fib = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]
%o for n in range(333):
%o res = 0
%o bit = resbit = 1
%o while bit<=n:
%o if n&bit: res += resbit
%o resbit*=2
%o if (n&bit) and (n&(bit*2)): resbit*=2
%o bit*=2
%o #print bin(n), bin(res),
%o an = i = 0
%o while res:
%o if res&1: an += fib[2+i]
%o i += 1
%o res >>= 1
%o print an,
%Y Cf. A014417, A000045.
%K nonn,base
%O 0,3
%A _Alex Ratushnyak_, Sep 25 2013
|