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.
%I A340873 #24 Feb 09 2021 11:00:58 %S A340873 0,1,3,2,6,4,4,3,11,7,7,5,9,5,5,4,12,12,12,8,8,8,8,6,10,10,10,6,14,6, %T A340873 6,5,21,13,13,13,13,13,13,9,17,9,9,9,17,9,9,7,19,11,11,11,11,11,11,7, %U A340873 15,15,15,7,15,7,7,6,22,22,22,14,14,14,14,14,22,14 %N A340873 a(n) is the number of iterations of A245471 needed to reach 1 starting from n. %C A340873 This sequence is well defined. %C A340873 Sketch of proof: %C A340873 - we focus on odd numbers n > 1, %C A340873 - if the binary representation of n ends with k 0's and one 1: %C A340873 in two steps we obtain a number with the same binary length as n %C A340873 and ending with k-1 0's and one 1, %C A340873 iterating again will eventually give a number ending with two or more 1's, %C A340873 - if the binary representation of n ends with k 1's (k > 1): %C A340873 in k+1 steps we obtain a number with a binary length strictly smaller %C A340873 than that of n, %C A340873 - so any odd number > 1 will eventually reach the number 1. %H A340873 Rémy Sigrist, <a href="/A340873/b340873.txt">Table of n, a(n) for n = 1..10000</a> %H A340873 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A340873 a(2*n) = a(n) + 1. %e A340873 For n = 10: %e A340873 - the trajectory of 10 is 10 -> 5 -> 14 -> 7 -> 8 -> 4 -> 2 -> 1, %e A340873 - so a(10) = 7. %o A340873 (PARI) a(n) = for (k=0, oo, if (n==1, return (k), n%2, n=bitxor(n, 2*n+1), n=n/2)) %Y A340873 Cf. A006577, A245471, A341194, A341218, A341220, A341231, A341235. %K A340873 nonn,base %O A340873 1,3 %A A340873 _Rémy Sigrist_, Jan 31 2021