login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A261923 Number of steps to reach 0, starting at n, and iteration the map x -> A261922(x). 3
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
a(A262279(n)) = n. - Reinhard Zumkeller, Sep 17 2015
EXAMPLE
13 -> 4 -> 3 -> 0, which takes 3 steps to reach 0, so a(13)=3.
PROG
(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
CROSSREFS
Sequence in context: A274036 A194449 A370820 * A124736 A144016 A354582
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 17 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 10:01 EDT 2024. Contains 371967 sequences. (Running on oeis4.)