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 A166549 #26 Apr 22 2022 09:06:19 %S A166549 0,5,4,11,13,10,7,12,9,14,6,11,16,70,13,67,18,10,15,23,69,20,12,66,17, %T A166549 17,9,71,22,22,14,68,19,19,11,65,73,11,16,24,16,70,8,21,21,59,13,67, %U A166549 75,18,18,56,26,64,72,45,10,23,15,23,61,31,69,31,77,20,20,28,58,28,12,66,74,74,17 %N A166549 The number of halving steps of the Collatz 3x+1 map to reach 1 starting from 2n-1. %C A166549 A given term k appears A131450(k) times. - _Flávio V. Fernandes_, Mar 13 2022 %H A166549 Alois P. Heinz, <a href="/A166549/b166549.txt">Table of n, a(n) for n = 1..10000</a> %H A166549 <a href="/index/3#3x1">Index to sequences related to the 3x+1 problem</a> %F A166549 a(n) = A006577(2n-1) - A075680(n). %p A166549 A006370 := proc(n) if type(n,'even') then n/2; else 3*n+1 ; end if; end proc: %p A166549 A006577 := proc(n) a := 0 ; x := n ; while x > 1 do x := A006370(x) ; a := a+1 ; end do; a ; end proc: %p A166549 A006667 := proc(n) a := 0 ; x := n ; while x > 1 do if type(x,'even') then x := x/2 ; else x := 3*x+1 ; a := a+1 ; end if; end do; a ; end proc: %p A166549 A075680 := proc(n) A006667(2*n-1) ; end proc: %p A166549 A166549 := proc(n) A006577(2*n-1)-A075680(n) ; end: seq(A166549(n),n=1..120) ; # _R. J. Mathar_, Oct 18 2009 %p A166549 # second Maple program: %p A166549 b:= proc(n) option remember; `if`(n=1, 0, %p A166549 1+b(`if`(n::even, n/2, (3*n+1)/2))) %p A166549 end: %p A166549 a:= n-> b(2*n-1): %p A166549 seq(a(n), n=1..75); # _Alois P. Heinz_, Mar 14 2022 %t A166549 b[n_] := b[n] = If[n == 1, 0, 1 + b[If[EvenQ[n], n/2, (3n+1)/2]]]; %t A166549 a[n_] := b[2n-1]; %t A166549 Table[a[n], {n, 1, 75}] (* _Jean-François Alcover_, Apr 22 2022, after _Alois P. Heinz_ *) %Y A166549 Cf. A131450, A006577, A075680. %K A166549 nonn %O A166549 1,2 %A A166549 _Jimin Park_, Oct 16 2009 %E A166549 Edited and extended by _R. J. Mathar_, Oct 18 2009