cp's OEIS Frontend

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.

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

This page as a plain text file.
%I A070165 #94 Feb 16 2025 08:32:46
%S A070165 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 A070165 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 A070165 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 A070165 Irregular triangle read by rows giving trajectory of n in Collatz problem.
%C A070165 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 A070165 A216059(n) is the smallest number not occurring in n-th row; see also A216022.
%C A070165 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 A070165 T. D. Noe, <a href="/A070165/b070165.txt">Rows n = 1..100 of triangle, flattened</a>
%H A070165 Gordon Charlton ("Beat Frequency"), <a href="/A070165/a070165.mp3">Hailstone Trajectory</a> (mp3 file)
%H A070165 David Eisenbud and Brady Haran, <a href="https://www.youtube.com/watch?v=5mFpVDpKX70">UNCRACKABLE? The Collatz Conjecture</a>, Numberphile Video, 2016.
%H A070165 David Rabahy, <a href="https://goo.gl/R14vDk">Hailstone Sequence presented as a spreadsheet</a>
%H A070165 Anatoly E. Voevudko, <a href="/A070165/a070165.txt">File of first 10K Collatz sequences</a>
%H A070165 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>
%H A070165 Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a>
%H A070165 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F A070165 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 A070165 The irregular array a(n,k) starts:
%e A070165 n\k   0  1  2  3  4   5  6   7  8  9 10 11 12 13 14 15 16 17 18 19
%e A070165 1:    1
%e A070165 2:    2  1
%e A070165 3:    3 10  5 16  8   4  2   1
%e A070165 4:    4  2  1
%e A070165 5:    5 16  8  4  2   1
%e A070165 6:    6  3 10  5 16   8  4   2  1
%e A070165 7:    7 22 11 34 17  52 26  13 40 20 10  5 16  8  4  2  1
%e A070165 8:    8  4  2  1
%e A070165 9:    9 28 14  7 22  11 34  17 52 26 13 40 20 10  5 16  8  4  2  1
%e A070165 10:  10  5 16  8  4   2  1
%e A070165 11:  11 34 17 52 26  13 40  20 10  5 16  8  4  2  1
%e A070165 12:  12  6  3 10  5  16  8   4  2  1
%e A070165 13:  13 40 20 10  5  16  8   4  2  1
%e A070165 14:  14  7 22 11 34  17 52  26 13 40 20 10  5 16  8  4  2  1
%e A070165 15:  15 46 23 70 35 106 53 160 80 40 20 10  5 16  8  4  2  1
%e A070165 ... Reformatted and extended by _Wolfdieter Lang_, Mar 20 2014
%p A070165 T:= proc(n) option remember; `if`(n=1, 1,
%p A070165       [n, T(`if`(n::even, n/2, 3*n+1))][])
%p A070165     end:
%p A070165 seq(T(n), n=1..15);  # _Alois P. Heinz_, Jan 29 2021
%t A070165 Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Flatten[Table[Collatz[n], {n, 10}]] (* _T. D. Noe_, Dec 03 2012 *)
%o A070165 (Haskell)
%o A070165 a070165 n k = a070165_tabf !! (n-1) !! (k-1)
%o A070165 a070165_tabf = map a070165_row [1..]
%o A070165 a070165_row n = (takeWhile (/= 1) $ iterate a006370 n) ++ [1]
%o A070165 a070165_list = concat a070165_tabf
%o A070165 -- _Reinhard Zumkeller_, Oct 07 2011
%o A070165 (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 A070165 (Python)
%o A070165 def a(n):
%o A070165     if n==1: return [1]
%o A070165     l=[n, ]
%o A070165     while True:
%o A070165         if n%2==0: n/=2
%o A070165         else: n = 3*n + 1
%o A070165         if n not in l:
%o A070165             l+=[n, ]
%o A070165             if n<2: break
%o A070165         else: break
%o A070165     return l
%o A070165 for n in range(1, 101): print(a(n)) # _Indranil Ghosh_, Apr 14 2017
%Y A070165 Cf. A006370 (step), A008908 (row lengths), A033493 (row sums).
%Y A070165 Cf. A220237 (sorted rows), A347270 (array), A192719.
%Y A070165 Cf. A070168 (Terras triangle), A256598 (reduced triangle).
%Y A070165 Cf. A254311, A257480 (and crossrefs therein).
%Y A070165 Cf. A280408 (primes).
%K A070165 nonn,easy,tabf
%O A070165 1,2
%A A070165 _Eric W. Weisstein_, Apr 23 2002
%E A070165 Name specified and row length A-number corrected by _Wolfdieter Lang_, Mar 20 2014