OFFSET
0,3
COMMENTS
See A014417 for the Fibonacci number system representation, also known as Zeckendorf expansion.
LINKS
A. Karttunen, Table of n, a(n) for n = 0..10946
FORMULA
a(0)=0; for n>0, a(n) = 1+a(A219641(n)).
PROG
(Scheme with memoization macro definec from Antti Karttunen's Intseq-library):
(PARI) A007895(n)=if(n<4, n>0, my(k=2, s, t); while(fibonacci(k++)<=n, ); while(k && n, t=fibonacci(k); if(t<=n, n-=t; s++); k--); s)
a(n)=my(s); while(n, n-=A007895(n); s++); s \\ Charles R Greathouse IV, Sep 02 2015
(Python)
from sympy import fibonacci
def a007895(n):
k=0
x=0
while n>0:
k=0
while fibonacci(k)<=n: k+=1
x+=10**(k - 3)
n-=fibonacci(k - 1)
return str(x).count("1")
def a219641(n): return n - a007895(n)
l=[0]
for n in range(1, 101):
l.append(1 + l[a219641(n)])
print(l) # Indranil Ghosh, Jun 09 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 24 2012
STATUS
approved