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.

A261923 Number of steps to reach 0, starting at n, and iteration the map x -> A261922(x).

This page as a plain text file.
%I A261923 #19 Sep 21 2023 11:10:20
%S A261923 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,
%T A261923 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,
%U A261923 2,2,3,3,2,2,2,4,3,2,3,3,2,2,2,4,2,2
%N A261923 Number of steps to reach 0, starting at n, and iteration the map x -> A261922(x).
%H A261923 Reinhard Zumkeller, <a href="/A261923/b261923.txt">Table of n, a(n) for n = 0..10000</a>
%F A261923 a(A262279(n)) = n. - _Reinhard Zumkeller_, Sep 17 2015
%e A261923 13 -> 4 -> 3 -> 0, which takes 3 steps to reach 0, so a(13)=3.
%o A261923 (Haskell)
%o A261923 a261923 n = fst $ until ((== 0) . snd)
%o A261923                         (\(step, x) -> (step + 1, a261922 x)) (0, n)
%o A261923 -- _Reinhard Zumkeller_, Sep 17 2015
%o A261923 (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
%o A261923 (Python)
%o A261923 def f(n): b=bin(n)[2:]; return next(k for k in range(2**len(b)) if bin(k)[2:] not in b)
%o A261923 def a(n): return 0 if n == 0 else 1 + a(f(n))
%o A261923 print([a(n) for n in range(99)]) # _Michael S. Branicky_, Sep 21 2023
%Y A261923 Cf. A261922, A261461, A262279.
%K A261923 nonn
%O A261923 0,3
%A A261923 _N. J. A. Sloane_, Sep 17 2015