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 A008908 #74 Aug 14 2025 02:37:26 %S A008908 1,2,8,3,6,9,17,4,20,7,15,10,10,18,18,5,13,21,21,8,8,16,16,11,24,11, %T A008908 112,19,19,19,107,6,27,14,14,22,22,22,35,9,110,9,30,17,17,17,105,12, %U A008908 25,25,25,12,12,113,113,20,33,20,33,20,20,108,108,7,28,28,28,15,15,15,103 %N A008908 a(n) = (1 + number of halving and tripling steps to reach 1 in the Collatz (3x+1) problem), or -1 if 1 is never reached. %C A008908 The number of steps (iterations of the map A006370) to reach 1 is given by A006577, this sequence counts 1 more. - _M. F. Hasler_, Nov 05 2017 %C A008908 When Collatz 3N+1 function is seen as an isometry over the dyadics, the halving step necessarily following each tripling is not counted, hence N -> N/2, if even, but N -> (3N+1)/2, if odd. Counting iterations of this map until reaching 1 leads to sequence A064433. - Michael Vielhaber (vielhaber(AT)gmail.com), Nov 18 2009 %D A008908 R. K. Guy, Unsolved Problems in Number Theory, E16. %H A008908 Reinhard Zumkeller, <a href="/A008908/b008908.txt">Table of n, a(n) for n = 1..10000</a> %H A008908 J. C. Lagarias, <a href="http://www.cecm.sfu.ca/organics/papers/lagarias/paper/html/paper.html">The 3x+1 problem and its generalizations</a>, Amer. Math. Monthly, 92 (1985), 3-23. %H A008908 Nitrxgen, <a href="http://www.nitrxgen.net/collatz/">Collatz Calculator</a> %H A008908 Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a> %H A008908 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A008908 a(n) = A006577(n) + 1. %F A008908 a(n) = f(n,1) with f(n,x) = if n=1 then x else f(A006370(n),x+1). %F A008908 a(A033496(n)) = A159999(A033496(n)). - _Reinhard Zumkeller_, May 04 2009 %F A008908 a(n) = A006666(n) + A078719(n). %F A008908 a(n) = length of n-th row in A070165. - _Reinhard Zumkeller_, May 11 2013 %p A008908 a:= proc(n) option remember; 1+`if`(n=1, 0, %p A008908 a(`if`(n::even, n/2, 3*n+1))) %p A008908 end: %p A008908 seq(a(n), n=1..100); # _Alois P. Heinz_, Jan 29 2021 %t A008908 Table[Length[NestWhileList[If[EvenQ[ # ], #/2, 3 # + 1] &, i, # != 1 &]], {i, 75}] %o A008908 (Haskell) %o A008908 a008908 = length . a070165_row %o A008908 -- _Reinhard Zumkeller_, May 11 2013, Aug 30 2012, Jul 19 2011 %o A008908 (PARI) a(n)=my(c=1); while(n>1, n=if(n%2, 3*n+1, n/2); c++); c \\ _Charles R Greathouse IV_, May 18 2015 %o A008908 (Python) %o A008908 def a(n): %o A008908 if n==1: return 1 %o A008908 x=1 %o A008908 while True: %o A008908 if n%2==0: n//=2 %o A008908 else: n = 3*n + 1 %o A008908 x+=1 %o A008908 if n<2: break %o A008908 return x %o A008908 print([a(n) for n in range(1, 101)]) # _Indranil Ghosh_, Apr 15 2017 %Y A008908 Cf. A006577, A006370, A006667, A075677. %K A008908 nonn,nice,look %O A008908 1,2 %A A008908 _N. J. A. Sloane_, _Bill Gosper_ %E A008908 More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001 %E A008908 "Escape clause" added to definition by _N. J. A. Sloane_, Jun 06 2017 %E A008908 Edited by _M. F. Hasler_, Nov 05 2017