The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 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
 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 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS The Collatz sequence is also called the 3x+1 sequence. LINKS Martin Y. Champel, Table of n, a(n) for n = 1..1000 EXAMPLE 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. 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 *) PROG (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 CROSSREFS Cf. A061641, A177729. Sequence in context: A240947 A023398 A186501 * A171438 A200683 A286541 Adjacent sequences:  A235449 A235450 A235451 * A235453 A235454 A235455 KEYWORD nonn AUTHOR Martin Y. Champel, Jan 10 2014 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 16 07:59 EDT 2021. Contains 343030 sequences. (Running on oeis4.)