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.
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, 26, 29, 29, 29, 32, 32, 32, 35, 35, 35, 36, 38, 38, 41, 41, 41, 42, 44, 44, 47, 47, 47, 50, 50, 50, 53, 53, 53, 54, 56, 56, 59, 59, 59, 62, 62, 62, 65, 65, 65
Offset: 1
Keywords
Examples
Let the C(n) function compute the Collatz sequence starting at n. For n = 1, C(1) = {1} then term 1 is 1. For n = 2, C(2) = {1,2} then term 2 is 2. 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. For n = 4, C(4) = C(3) then term 4 is 5. For n = 5, C(5) = C(4) = C(3) then term 5 is 5. For n = 6, C(6) = {1,2,3,4,5,6,8,10,16} then term 6 is 6.
Links
- Martin Y. Champel, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
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 *)
-
Python
def A235452(n=100): a = set([]) A235452 = {1: 1} for i in range(2, n): c = i a.add(c) while c != 1: if c % 2 == 1: c = 3 * c + 1 a.add(c) c = c / 2 a.add(c) k = 1 while k in a: k += 1 A235452[i] = k - 1 return A235452 seq_map = A235452() for n in range(1, len(seq_map) + 1): print(seq_map[n], end=", ")
Comments