A261923 Number of steps to reach 0, starting at n, and iteration the map x -> A261922(x).
0, 1, 2, 1, 2, 2, 3, 1, 2, 2, 2, 3, 3, 3, 3, 1, 2, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 3, 2, 2, 3, 3, 2, 2, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 3, 2, 2, 3, 3, 2, 2, 2, 4, 3, 2, 3, 3, 2, 2, 2, 4, 2, 2
Offset: 0
Keywords
Examples
13 -> 4 -> 3 -> 0, which takes 3 steps to reach 0, so a(13)=3.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
a261923 n = fst $ until ((== 0) . snd) (\(step, x) -> (step + 1, a261922 x)) (0, n) -- Reinhard Zumkeller, Sep 17 2015
-
PARI
a(n) = if (n==0, 0, my(k=1, x=A261922(n)); while (x, x=A261922(x); k++); k); \\ Michel Marcus, Sep 20 2023
-
Python
def f(n): b=bin(n)[2:]; return next(k for k in range(2**len(b)) if bin(k)[2:] not in b) def a(n): return 0 if n == 0 else 1 + a(f(n)) print([a(n) for n in range(99)]) # Michael S. Branicky, Sep 21 2023
Formula
a(A262279(n)) = n. - Reinhard Zumkeller, Sep 17 2015