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.

Showing 1-5 of 5 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Eric W. Weisstein, Apr 23 2002

Keywords

Comments

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]
A216059(n) is the smallest number not occurring in n-th row; see also A216022.
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

Examples

			The irregular array a(n,k) starts:
n\k   0  1  2  3  4   5  6   7  8  9 10 11 12 13 14 15 16 17 18 19
1:    1
2:    2  1
3:    3 10  5 16  8   4  2   1
4:    4  2  1
5:    5 16  8  4  2   1
6:    6  3 10  5 16   8  4   2  1
7:    7 22 11 34 17  52 26  13 40 20 10  5 16  8  4  2  1
8:    8  4  2  1
9:    9 28 14  7 22  11 34  17 52 26 13 40 20 10  5 16  8  4  2  1
10:  10  5 16  8  4   2  1
11:  11 34 17 52 26  13 40  20 10  5 16  8  4  2  1
12:  12  6  3 10  5  16  8   4  2  1
13:  13 40 20 10  5  16  8   4  2  1
14:  14  7 22 11 34  17 52  26 13 40 20 10  5 16  8  4  2  1
15:  15 46 23 70 35 106 53 160 80 40 20 10  5 16  8  4  2  1
... Reformatted and extended by _Wolfdieter Lang_, Mar 20 2014
		

Crossrefs

Cf. A006370 (step), A008908 (row lengths), A033493 (row sums).
Cf. A220237 (sorted rows), A347270 (array), A192719.
Cf. A070168 (Terras triangle), A256598 (reduced triangle).
Cf. A254311, A257480 (and crossrefs therein).
Cf. A280408 (primes).

Programs

  • Haskell
    a070165 n k = a070165_tabf !! (n-1) !! (k-1)
    a070165_tabf = map a070165_row [1..]
    a070165_row n = (takeWhile (/= 1) $ iterate a006370 n) ++ [1]
    a070165_list = concat a070165_tabf
    -- Reinhard Zumkeller, Oct 07 2011
    
  • Maple
    T:= proc(n) option remember; `if`(n=1, 1,
          [n, T(`if`(n::even, n/2, 3*n+1))][])
        end:
    seq(T(n), n=1..15);  # Alois P. Heinz, Jan 29 2021
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Flatten[Table[Collatz[n], {n, 10}]] (* T. D. Noe, Dec 03 2012 *)
  • 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
    
  • Python
    def a(n):
        if n==1: return [1]
        l=[n, ]
        while True:
            if n%2==0: n/=2
            else: n = 3*n + 1
            if n not in l:
                l+=[n, ]
                if n<2: break
            else: break
        return l
    for n in range(1, 101): print(a(n)) # Indranil Ghosh, Apr 14 2017

Formula

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

Extensions

Name specified and row length A-number corrected by Wolfdieter Lang, Mar 20 2014

A177729 Positive integers which do not appear in a Collatz sequence starting from a smaller positive integer.

Original entry on oeis.org

1, 2, 3, 6, 7, 9, 12, 15, 18, 19, 21, 24, 25, 27, 30, 33, 36, 37, 39, 42, 43, 45, 48, 51, 54, 55, 57, 60, 63, 66, 69, 72, 73, 75, 78, 79, 81, 84, 87, 90, 93, 96, 97, 99, 102, 105, 108, 109, 111, 114, 115, 117, 120, 123, 126, 127, 129, 132, 133, 135, 138, 141
Offset: 1

Views

Author

Raul D. Miller, May 12 2010

Keywords

Comments

A variant of A061641, which is the main entry for this sequence.
The inclusion of 2 is apparently due to a non-standard definition of a Collatz sequence; A177729 assumes that the Collatz sequence ends when it reaches 1, whereas the standard definition includes the periodic 1,4,2,... from that point. The inclusion of 0 in A061641 is a bit odd, but is not actually wrong. One usually looks only at positive integers for Collatz sequences. - Franklin T. Adams-Watters, May 14 2010

Examples

			Collatz 1: 1; Collatz 2: 2,1; Collatz 3: 3,10,5,16,8,4,2,1; Collatz 6: 6,3,10,...
		

Crossrefs

Programs

  • Haskell
    a177729 = head . a192719_row  -- Reinhard Zumkeller, Jan 03 2013
  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; t={1}; Do[If[FreeQ[Union@@Table[coll[i],{i,n-1}],n],AppendTo[t,n]],{n,2,141}]; t (* Jayanta Basu, May 29 2013 *)

Formula

a(n) = A192719(n,1), see also A220263. - Reinhard Zumkeller, Jan 03 2013

A220263 Lengths of Collatz trajectories starting with terms of A177729.

Original entry on oeis.org

1, 2, 8, 9, 17, 20, 10, 18, 21, 21, 8, 11, 24, 112, 19, 27, 22, 22, 35, 9, 30, 17, 12, 25, 113, 113, 33, 20, 108, 28, 15, 23, 116, 15, 36, 36, 23, 10, 31, 18, 18, 13, 119, 26, 26, 39, 114, 114, 70, 34, 34, 21, 21, 47, 109, 47, 122, 29, 29, 42, 16, 16, 24
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 03 2013

Keywords

Comments

Row lengths in A192719.

Crossrefs

Cf. A006577.

Programs

  • Haskell
    a220263 = length . a192719_row
  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; t={1}; Do[If[FreeQ[Union@@Table[coll[i],{i,n-1}],n],AppendTo[t,Length[coll[n]]]],{n,2,144}]; t (* Jayanta Basu, May 29 2013 *)

A217743 Excess of number of odds in the form 4k+1 over number of odds in the form 4k+3 in Collatz trajectory of n.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 1, 3, 2, 3, 1, 3, 2, 0, 1, 4, 3, 3, 2, 2, 3, 1, 1, 4, 3, -6, 2, 4, 0, -6, 1, 5, 4, 2, 3, 3, 3, 2, 2, -5, 2, 4, 3, 5, 1, -5, 1, 4, 4, 4, 3, 3, -6, -6, 2, 5, 4, 3, 0, 2, -6, -8, 1, 5, 5, 3, 4, 4, 2, -4, 3, -5, 3, 2, 3, 5, 2, 2, 2, 3, -5, -5
Offset: 1

Views

Author

Jayanta Basu, Mar 23 2013

Keywords

Crossrefs

Cf. A217744 (n having equal numbers of 4k+1 and 4k+3 terms).

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3*# + 1] &, n, # > 1 &]; Table[Length[Select[Collatz[n], Mod[#, 4] == 1 &]] - Length[Select[Collatz[n], Mod[#, 4] == 3 &]], {n,60}]
    Table[m4=Mod[NestWhileList[If[EvenQ[#],#/2,3*#+1]&,n,#>1&],4];Count[m4, 1]-Count[m4, 3], {n, 60}] (* Zak Seidov, Mar 23 2013 *)

A217744 Numbers whose Collatz trajectory contains equal number of terms of the form 4k+1 and 4k+3.

Original entry on oeis.org

15, 30, 60, 120, 151, 239, 240, 255, 302, 377, 423, 425, 478, 479, 480, 510, 593, 604, 669, 685, 743, 754, 755, 846, 847, 850, 851, 939, 956, 958, 960, 1020, 1053, 1057, 1186, 1191, 1208, 1297, 1321, 1338, 1341, 1370, 1375, 1473, 1486, 1487, 1508, 1509, 1510
Offset: 1

Views

Author

Jayanta Basu, Mar 23 2013

Keywords

Crossrefs

Programs

  • Mathematica
    Collatz[n_] :=NestWhileList[If[EvenQ[#], #/2, 3*# + 1] &, n, # > 1 &]; t = {}; Do[If[Length[Select[Collatz[n], Mod[#, 4] == 1 &]] -Length[Select[Collatz[n], Mod[#, 4] == 3 &]] == 0, AppendTo[t, n]], {n, 1500}]; t
Showing 1-5 of 5 results.