cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A219642 Number of steps to reach 0 starting with n and using the iterated process: x -> x - (number of 1's in Zeckendorf expansion of x).

This page as a plain text file.
%I A219642 #22 Mar 09 2021 19:13:58
%S A219642 0,1,2,3,3,4,4,5,6,6,7,7,7,8,8,9,9,9,10,10,10,11,11,12,12,12,13,13,13,
%T A219642 14,14,14,15,15,16,16,17,17,17,18,18,18,19,19,19,20,20,21,21,21,22,22,
%U A219642 22,22,23,24,24,25,25,25,26,26,26,27,27,27,28,28,29,29
%N A219642 Number of steps to reach 0 starting with n and using the iterated process: x -> x - (number of 1's in Zeckendorf expansion of x).
%C A219642 See A014417 for the Fibonacci number system representation, also known as Zeckendorf expansion.
%H A219642 A. Karttunen, <a href="/A219642/b219642.txt">Table of n, a(n) for n = 0..10946</a>
%F A219642 a(0)=0; for n>0, a(n) = 1+a(A219641(n)).
%o A219642 (Scheme with memoization macro definec from _Antti Karttunen_'s Intseq-library):
%o A219642 (definec (A219642 n) (if (zero? n) n (+ 1 (A219642 (A219641 n)))))
%o A219642 (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)
%o A219642 a(n)=my(s); while(n, n-=A007895(n); s++); s \\ _Charles R Greathouse IV_, Sep 02 2015
%o A219642 (Python)
%o A219642 from sympy import fibonacci
%o A219642 def a007895(n):
%o A219642     k=0
%o A219642     x=0
%o A219642     while n>0:
%o A219642         k=0
%o A219642         while fibonacci(k)<=n: k+=1
%o A219642         x+=10**(k - 3)
%o A219642         n-=fibonacci(k - 1)
%o A219642     return str(x).count("1")
%o A219642 def a219641(n): return n - a007895(n)
%o A219642 l=[0]
%o A219642 for n in range(1, 101):
%o A219642     l.append(1 + l[a219641(n)])
%o A219642 print(l) # _Indranil Ghosh_, Jun 09 2017
%Y A219642 Cf. A007895, A014417, A219640, A219641, A219643-A219645, A219648. Analogous sequence for binary system: A071542, for factorial number system: A219652.
%K A219642 nonn
%O A219642 0,3
%A A219642 _Antti Karttunen_, Nov 24 2012