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 A235452 #35 Mar 19 2023 14:43:58 %S A235452 1,2,5,5,5,6,8,8,11,11,11,14,14,14,17,17,17,18,20,20,23,23,23,24,26, %T A235452 26,29,29,29,32,32,32,35,35,35,36,38,38,41,41,41,42,44,44,47,47,47,50, %U A235452 50,50,53,53,53,54,56,56,59,59,59,62,62,62,65,65,65 %N A235452 Take the union of all the sequences Collatz(i) for i <= n. The number a(n) is the largest of consecutive numbers beginning with 1. %C A235452 The Collatz sequence is also called the 3x+1 sequence. %H A235452 Martin Y. Champel, <a href="/A235452/b235452.txt">Table of n, a(n) for n = 1..1000</a> %e A235452 Let the C(n) function compute the Collatz sequence starting at n. %e A235452 For n = 1, C(1) = {1} then term 1 is 1. %e A235452 For n = 2, C(2) = {1,2} then term 2 is 2. %e A235452 For n = 3, C(3) = {3,10,5,16,8,4,2,1} = {1,2,3,4,5,8,10,16} then it contains {1,2,3,4,5} but not {1,2,3,4,5,6} then term 3 is 5. %e A235452 For n = 4, C(4) = C(3) then term 4 is 5. %e A235452 For n = 5, C(5) = C(4) = C(3) then term 5 is 5. %e A235452 For n = 6, C(6) = {1,2,3,4,5,6,8,10,16} then term 6 is 6. %t A235452 Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countConsec[lst_] := Module[{cnt = 0, i = 1}, While[i <= Length[lst] && lst[[i]] == i, cnt++; i++]; cnt]; mx = 0; u = {}; Table[c = Collatz[n]; u = Union[u, c]; mx = Max[mx, countConsec[u]], {n, 65}] (* _T. D. Noe_, Feb 23 2014 *) %o A235452 (Python) %o A235452 def A235452(n=100): %o A235452 a = set([]) %o A235452 A235452 = {1: 1} %o A235452 for i in range(2, n): %o A235452 c = i %o A235452 a.add(c) %o A235452 while c != 1: %o A235452 if c % 2 == 1: %o A235452 c = 3 * c + 1 %o A235452 a.add(c) %o A235452 c = c / 2 %o A235452 a.add(c) %o A235452 k = 1 %o A235452 while k in a: %o A235452 k += 1 %o A235452 A235452[i] = k - 1 %o A235452 return A235452 %o A235452 seq_map = A235452() %o A235452 for n in range(1, len(seq_map) + 1): %o A235452 print(seq_map[n], end=", ") %Y A235452 Cf. A061641, A177729. %K A235452 nonn %O A235452 1,2 %A A235452 _Martin Y. Champel_, Jan 10 2014