|
|
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
|
|
|
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)
(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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|