OFFSET
0,3
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000
MATHEMATICA
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 *)
PROG
(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]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Aug 03 2012
EXTENSIONS
Data corrected by Amiram Eldar, Oct 11 2019
STATUS
approved