login
Irregular triangle read by rows giving trajectory of n in Collatz problem.
120

%I #93 Feb 17 2022 20:34:19

%S 1,2,1,3,10,5,16,8,4,2,1,4,2,1,5,16,8,4,2,1,6,3,10,5,16,8,4,2,1,7,22,

%T 11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,8,4,2,1,9,28,14,7,22,11,34,

%U 17,52,26,13,40,20,10,5,16,8,4,2,1,10,5,16,8,4,2,1,11,34,17,52,26,13

%N Irregular triangle read by rows giving trajectory of n in Collatz problem.

%C n-th row has A008908(n) entries (unless some n never reaches 1, in which case the triangle ends with an infinite row). [Escape clause added by _N. J. A. Sloane_, Jun 06 2017]

%C A216059(n) is the smallest number not occurring in n-th row; see also A216022.

%C Comment on the mp3 file from Gordon Charlton (the recording artist Beat Frequency). The piece uses the first 3242 terms (i.e. the first 100 hailstone sequences), with pitch modulus 36, duration modulus 2. Its musicality stems from the many repetitions and symmetries within the sequence, and in particular the infrequency of multiples of 3. This means that when the pitch modulus is a multiple of 12 the notes are predominantly in the symmetric octatonic scale, known to modern classical composers as the second of Messiaen's modes of limited transposition, and to jazz musicians as half-whole diminished. - _N. J. A. Sloane_, Jan 30 2019

%H T. D. Noe, <a href="/A070165/b070165.txt">Rows n = 1..100 of triangle, flattened</a>

%H Gordon Charlton ("Beat Frequency"), <a href="/A070165/a070165.mp3">Hailstone Trajectory</a> (mp3 file)

%H David Eisenbud and Brady Haran, <a href="https://www.youtube.com/watch?v=5mFpVDpKX70">UNCRACKABLE? The Collatz Conjecture</a>, Numberphile Video, 2016.

%H David Rabahy, <a href="https://goo.gl/R14vDk">Hailstone Sequence presented as a spreadsheet</a>

%H Anatoly E. Voevudko, <a href="/A070165/a070165.txt">File of first 10K Collatz sequences</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a>

%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>

%F T(n,k) = T^{(k)}(n) with the k-th iterate of the Collatz map T with T(n) = 3*n+1 if n is odd and T(n) = n/2 if n is even, n >= 1. T^{(0)}(n) = n. k = 0, 1, ..., A008908(n) - 1. - _Wolfdieter Lang_, Mar 20 2014

%e The irregular array a(n,k) starts:

%e n\k 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

%e 1: 1

%e 2: 2 1

%e 3: 3 10 5 16 8 4 2 1

%e 4: 4 2 1

%e 5: 5 16 8 4 2 1

%e 6: 6 3 10 5 16 8 4 2 1

%e 7: 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1

%e 8: 8 4 2 1

%e 9: 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1

%e 10: 10 5 16 8 4 2 1

%e 11: 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1

%e 12: 12 6 3 10 5 16 8 4 2 1

%e 13: 13 40 20 10 5 16 8 4 2 1

%e 14: 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1

%e 15: 15 46 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2 1

%e ... Reformatted and extended by _Wolfdieter Lang_, Mar 20 2014

%p T:= proc(n) option remember; `if`(n=1, 1,

%p [n, T(`if`(n::even, n/2, 3*n+1))][])

%p end:

%p seq(T(n), n=1..15); # _Alois P. Heinz_, Jan 29 2021

%t Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Flatten[Table[Collatz[n], {n, 10}]] (* _T. D. Noe_, Dec 03 2012 *)

%o (Haskell)

%o a070165 n k = a070165_tabf !! (n-1) !! (k-1)

%o a070165_tabf = map a070165_row [1..]

%o a070165_row n = (takeWhile (/= 1) $ iterate a006370 n) ++ [1]

%o a070165_list = concat a070165_tabf

%o -- _Reinhard Zumkeller_, Oct 07 2011

%o (PARI) row(n, lim=0)={if (n==1, return([1])); my(c=n, e=0, L=List(n)); if(lim==0, e=1; lim=n*10^6); for(i=1, lim, if(c%2==0, c=c/2, c=3*c+1); listput(L, c); if(e&&c==1, break)); return(Vec(L)); } \\ _Anatoly E. Voevudko_, Mar 26 2016; edited by _Michel Marcus_, Aug 10 2021

%o (Python)

%o def a(n):

%o if n==1: return [1]

%o l=[n, ]

%o while True:

%o if n%2==0: n/=2

%o else: n = 3*n + 1

%o if n not in l:

%o l+=[n, ]

%o if n<2: break

%o else: break

%o return l

%o for n in range(1, 101): print(a(n)) # _Indranil Ghosh_, Apr 14 2017

%Y Cf. A006370 (step), A008908 (row lengths), A033493 (row sums).

%Y Cf. A220237 (sorted rows), A347270 (array), A192719.

%Y Cf. A070168 (Terras triangle), A256598 (reduced triangle).

%Y Cf. A254311, A257480 (and crossrefs therein).

%Y Cf. A280408 (primes).

%K nonn,easy,tabf

%O 1,2

%A _Eric W. Weisstein_, Apr 23 2002

%E Name specified and row length A-number corrected by _Wolfdieter Lang_, Mar 20 2014