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 A008896 #18 Jul 08 2025 01:23:23 %S A008896 66,33,98,49,146,73,218,109,326,163,488,244,122,61,182,91,272,136,68, %T A008896 34,17,50,25,74,37,110,55,164,82,41,122,61,182,91,272,136,68,34,17,50, %U A008896 25,74,37,110,55,164,82,41,122 %N A008896 3x - 1 sequence starting at 66. %D A008896 R. K. Guy, Unsolved Problems in Number Theory, E16. %H A008896 <a href="/index/Rec#order_18">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1). %F A008896 a(0) = 66, a(n) = a(n - 1)/2 if a(n - 1) is even, otherwise 3a(n - 1) - 1. %t A008896 NestList[If[EvenQ[#], #/2, 3# - 1] &, 66, 50] (* or *) PadRight[ {66, 33, 98, 49, 146, 73, 218, 109, 326, 163, 488, 244}, 120, {68, 34, 17, 50, 25, 74, 37, 110, 55, 164, 82, 41, 122, 61, 182, 91, 272, 136}] (* _Harvey P. Dale_, Sep 02 2018 *) %o A008896 (Scala) def collatz(n: Int): Int = n % 2 match { %o A008896 case 0 => n / 2 %o A008896 case _ => 3 * n + 1 %o A008896 } %o A008896 def collatzSeq(n: Int): LazyList[Int] = LazyList.iterate(n)(collatz) %o A008896 collatzSeq(-33).take(100).toList.map(_ * -1) // _Alonso del Arte_, Apr 25 2020 %Y A008896 Cf. A008880 (3x + 1 sequence starting at 33). %K A008896 nonn,easy %O A008896 0,1 %A A008896 _N. J. A. Sloane_ %E A008896 More specific name from _Alonso del Arte_, Apr 25 2020 (was "x -> x/2 if x even, x -> 3x - 1 if x odd").