%I #27 Oct 16 2019 03:24:34
%S 0,1,4,5,18,16,17,20,21,74,72,73,66,64,65,68,69,82,80,81,84,85,298,
%T 296,297,290,288,289,292,293,266,264,265,258,256,257,260,261,274,272,
%U 273,276,277,330,328,329,322,320,321,324,325,338,336,337,340,341,1194
%N Decimal equivalent of binary number in A215022.
%H Amiram Eldar, <a href="/A215024/b215024.txt">Table of n, a(n) for n = 0..10000</a>
%t ind[n_] := Floor[Log[Abs[n]*Sqrt[5] + 1/2]/Log[GoldenRatio]]; f[1] = 1; f[n_] := If[n > 0, i = ind[n - 1]; If[EvenQ[i], i++]; i, i = ind[-n]; If[OddQ[i], i++]; i]; a[n_] := Module[{k = n, s = 0}, While[k != 0, i = f[k]; s += 2^(i - 1); k -= Fibonacci[-i]]; s]; Array[a, 100, 0] (* _Amiram Eldar_, Oct 15 2019 *)
%o (PARI) a(n)=if(n<2,return(n));my(s=1,k=1,v);while(s<n, s+=fibonacci(k+=2));v=binary(2^k/2);n-=fibonacci(k);forstep(i=k-2,1,-1,if(abs(n-fibonacci(-i))<abs(n),n-=fibonacci(-i);v[#v+1-i]=1;i--));subst(Pol(v),x,2) \\ _Charles R Greathouse IV_, Aug 03 2012 [Caution: returns wrong values for some values of n > 15. _Amiram Eldar_, Oct 15 2019]
%Y Cf. A215022-A215025, A014417, A214248.
%K nonn,base
%O 0,3
%A _N. J. A. Sloane_, Aug 03 2012
%E Data corrected by _Amiram Eldar_, Oct 11 2019