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.

Previous Showing 21-30 of 58 results. Next

A354236 A(n,k) is the n-th number m such that the Collatz (or 3x+1) trajectory starting at m contains exactly k odd integers; square array A(n,k), n>=1, k>=1, read by antidiagonals.

Original entry on oeis.org

1, 5, 2, 3, 10, 4, 17, 6, 20, 8, 11, 34, 12, 21, 16, 7, 22, 35, 13, 40, 32, 9, 14, 23, 68, 24, 42, 64, 25, 18, 15, 44, 69, 26, 80, 128, 33, 49, 19, 28, 45, 70, 48, 84, 256, 43, 65, 50, 36, 29, 46, 75, 52, 85, 512, 57, 86, 66, 51, 37, 30, 88, 136, 53, 160, 1024
Offset: 1

Views

Author

Alois P. Heinz, May 20 2022

Keywords

Examples

			Square array A(n,k) begins:
    1,   5,  3,  17, 11,  7,  9,  25,  33,  43, ...
    2,  10,  6,  34, 22, 14, 18,  49,  65,  86, ...
    4,  20, 12,  35, 23, 15, 19,  50,  66,  87, ...
    8,  21, 13,  68, 44, 28, 36,  51,  67,  89, ...
   16,  40, 24,  69, 45, 29, 37,  98, 130, 172, ...
   32,  42, 26,  70, 46, 30, 38,  99, 131, 173, ...
   64,  80, 48,  75, 88, 56, 72, 100, 132, 174, ...
  128,  84, 52, 136, 90, 58, 74, 101, 133, 177, ...
  256,  85, 53, 138, 92, 60, 76, 102, 134, 178, ...
  512, 160, 96, 140, 93, 61, 77, 196, 260, 179, ...
		

Crossrefs

Row n=1 gives A092893(k-1).
Main diagonal gives A380244.

Programs

  • Maple
    b:= proc(n) option remember; irem(n, 2, 'r')+
          `if`(n=1, 0, b(`if`(n::odd, 3*n+1, r)))
        end:
    A:= proc() local h, p, q; p, q:= proc() [] end, 0;
          proc(n, k)
            if k=1 then return 2^(n-1) fi;
            while nops(p(k))
    				
  • Mathematica
    b[n_] := b[n] = Module[{q, r}, {q, r} = QuotientRemainder[n, 2]; r +
         If[n == 1, 0, b[If[OddQ[n], 3*n + 1, q]]]];
    A = Module[{h, p, q}, p[_] = {}; q = 0;
         Function[{n, k}, If[k == 1, 2^(n - 1)];
         While[Length[p[k]] < n, q = q + 1;
            h = b[q];
            p[h] = Append[p[h], q]];
         p[k][[n]]]];
    Table[Table[A[n, 1+d-n], {n, 1, d}], {d, 1, 12}] // Flatten (* Jean-François Alcover, Jun 02 2022, after Alois P. Heinz *)

Formula

A078719(A(n,k)) = k.

A062060 Numbers with 10 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

43, 86, 87, 89, 172, 173, 174, 177, 178, 179, 344, 346, 348, 349, 354, 355, 356, 357, 358, 385, 423, 688, 692, 693, 696, 698, 705, 708, 709, 710, 712, 714, 716, 717, 729, 761, 769, 770, 771, 777, 846, 847, 1376, 1384, 1386, 1392, 1393, 1396, 1397, 1410, 1411, 1415
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 10; A006667(a(n)) = 9.

Examples

			The Collatz trajectory of 43 is (43, 130, 65, 196, 98, 49, 148, 74, 37, 112, 56, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which contains 10 odd integers.
		

References

  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Column k=10 of A354236.

Programs

  • Haskell
    import Data.List (elemIndices)
    a062060 n = a062060_list !! (n-1)
    a062060_list = map (+ 1) $ elemIndices 10 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
    
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[1000], countOdd[Collatz[#]] == 10 &] (* T. D. Noe, Dec 03 2012 *)
  • Python
    def a(n):
        l=[n]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            if n not in l:
                l.append(n)
                if n<2: break
            else: break
        return len([1 for i in l if i%2])
    print([n for n in range(40, 1501) if a(n)==10]) # Indranil Ghosh, Apr 14 2017

A070167 a(n) is the smallest starting value that produces a Collatz sequence in which n occurs.

Original entry on oeis.org

1, 2, 3, 3, 3, 6, 7, 3, 9, 3, 7, 12, 7, 9, 15, 3, 7, 18, 19, 7, 21, 7, 15, 24, 25, 7, 27, 9, 19, 30, 27, 21, 33, 7, 15, 36, 37, 25, 39, 7, 27, 42, 43, 19, 45, 15, 27, 48, 43, 33, 51, 7, 15, 54, 55, 37, 57, 19, 39, 60, 27, 27, 63, 21, 43, 66, 39, 45, 69, 15, 27, 72, 73, 43, 75, 25
Offset: 1

Views

Author

Eric W. Weisstein, Apr 23 2002

Keywords

Comments

a(n) <= n. - Robert G. Wilson v, Jan 14 2015

Crossrefs

Programs

  • Haskell
    import Data.List (findIndex)
    import Data.Maybe (fromJust)
    a070167 n = fromJust (findIndex (elem n) a070165_tabf) + 1
    -- Reinhard Zumkeller, Jan 02 2013
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 100; t = Table[0, {nn}]; n = 0; zeros = nn; While[zeros > 0, n++; c = Collatz[n]; Do[If[i <= nn && t[[i]] == 0, t[[i]] = n; zeros--], {i, c}]]; t (* T. D. Noe, Dec 03 2012 *)

A062053 Numbers with exactly 3 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

3, 6, 12, 13, 24, 26, 48, 52, 53, 96, 104, 106, 113, 192, 208, 212, 213, 226, 227, 384, 416, 424, 426, 452, 453, 454, 768, 832, 848, 852, 853, 904, 906, 908, 909, 1536, 1664, 1696, 1704, 1706, 1808, 1812, 1813, 1816, 1818, 3072, 3328, 3392, 3408, 3412, 3413, 3616
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd (A006370).
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 3; A006667(a(n)) = 2.

Examples

			The Collatz trajectory of 3 is (3,10,5,16,8,4,2,1), which contains 3 odd integers.
		

References

  • J. R. Goodwin, Results on the Collatz Conjecture, Sci. Ann. Comput. Sci. 13 (2003) pp. 1-16
  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Cf. A198584 (this sequence without the even numbers).
See also A198587.
Column k=3 of A354236.

Programs

  • Haskell
    import Data.List (elemIndices)
    a062053 n = a062053_list !! (n-1)
    a062053_list = map (+ 1) $ elemIndices 3 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
  • Mathematica
    Collatz[n_?OddQ] := (3n + 1)/2; Collatz[n_?EvenQ] := n/2; oddIntCollatzCount[n_] := Length[Select[NestWhileList[Collatz, n, # != 1 &], OddQ]]; Select[Range[4000], oddIntCollatzCount[#] == 3 &] (* Alonso del Arte, Oct 28 2011 *)

Formula

The two formulas giving this sequence are listed in Corollary 3.1 and Corollary 3.2 in J. R. Goodwin with the following caveats: the value x cannot equal zero in Corollary 3.2, one must multiply the formulas by all powers of 2 (2^1, 2^2, ...) to get the evens. - Jeffrey R. Goodwin, Oct 26 2011

A062055 Numbers with 5 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

11, 22, 23, 44, 45, 46, 88, 90, 92, 93, 176, 180, 181, 184, 186, 201, 352, 360, 362, 368, 369, 372, 373, 401, 402, 403, 704, 720, 724, 725, 736, 738, 739, 744, 746, 753, 802, 803, 804, 805, 806, 1408, 1440, 1448, 1450, 1472, 1476, 1477, 1478, 1488, 1492, 1493, 1506
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 5; A006667(a(n)) = 4.

Examples

			The Collatz trajectory of 11 is (11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which contains 5 odd integers.
		

References

  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Column k=5 of A354236.

Programs

  • Haskell
    import Data.List (elemIndices)
    a062055 n = a062055_list !! (n-1)
    a062055_list = map (+ 1) $ elemIndices 5 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[2000], countOdd[Collatz[#]] == 5 &] (* T. D. Noe, Dec 03 2012 *)

A062056 Numbers with 6 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

7, 14, 15, 28, 29, 30, 56, 58, 60, 61, 112, 116, 117, 120, 122, 224, 232, 234, 240, 241, 244, 245, 267, 448, 464, 468, 469, 480, 482, 483, 488, 490, 497, 534, 535, 537, 896, 928, 936, 938, 960, 964, 965, 966, 976, 980, 981, 985, 994, 995, 1068, 1069, 1070, 1073
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 6; A006667(a(n)) = 5.

Examples

			The Collatz trajectory of 7 is (7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which contains 6 odd integers.
		

References

  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Column k=6 of A354236.

Programs

  • Haskell
    import Data.List (elemIndices)
    a062056 n = a062056_list !! (n-1)
    a062056_list = map (+ 1) $ elemIndices 6 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[1000], countOdd[Collatz[#]] == 6 &] (* T. D. Noe, Dec 03 2012 *)

A062057 Numbers with 7 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

9, 18, 19, 36, 37, 38, 72, 74, 76, 77, 81, 144, 148, 149, 152, 154, 162, 163, 288, 296, 298, 304, 308, 309, 321, 324, 325, 326, 331, 576, 592, 596, 597, 608, 616, 618, 625, 642, 643, 648, 650, 652, 653, 662, 663, 713, 715, 1152, 1184, 1192, 1194, 1216, 1232, 1236, 1237
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 7; A006667(a(n)) = 6.

Examples

			The Collatz trajectory of 9 is (9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which contains 7 odd integers.
		

References

  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Column k=7 of A354236.

Programs

  • Haskell
    import Data.List (elemIndices)
    a062057 n = a062057_list !! (n-1)
    a062057_list = map (+ 1) $ elemIndices 7 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[1000], countOdd[Collatz[#]] == 7 &] (* T. D. Noe, Dec 03 2012 *)

A062058 Numbers with 8 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

25, 49, 50, 51, 98, 99, 100, 101, 102, 196, 197, 198, 200, 202, 204, 205, 217, 392, 394, 396, 397, 400, 404, 405, 408, 410, 433, 434, 435, 441, 475, 784, 788, 789, 792, 794, 800, 808, 810, 816, 820, 821, 833, 857, 866, 867, 868, 869, 870, 875, 882, 883, 950, 951, 953
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 8; A006667(a(n)) = 7.

Examples

			The Collatz trajectory of 25 is (25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which contains 8 odd integers.
		

References

  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Column k=8 of A354236.

Programs

  • Haskell
    import Data.List (elemIndices)
    a062058 n = a062058_list !! (n-1)
    a062058_list = map (+ 1) $ elemIndices 8 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[1000], countOdd[Collatz[#]] == 8 &] (* T. D. Noe, Dec 03 2012 *)

A062059 Numbers with 9 odd integers in their Collatz (or 3x+1) trajectory.

Original entry on oeis.org

33, 65, 66, 67, 130, 131, 132, 133, 134, 260, 261, 262, 264, 266, 268, 269, 273, 289, 520, 522, 524, 525, 528, 529, 532, 533, 536, 538, 546, 547, 555, 571, 577, 578, 579, 583, 633, 635, 1040, 1044, 1045, 1048, 1050, 1056, 1058, 1059, 1064, 1066, 1072, 1076, 1077
Offset: 1

Views

Author

Keywords

Comments

The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
A078719(a(n)) = 9; A006667(a(n)) = 8.

Examples

			The Collatz trajectory of 33 is (33, 100, 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which contains 9 odd integers.
		

References

  • J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a062059 n = a062059_list !! (n-1)
    a062059_list = map (+ 1) $ elemIndices 9 a078719_list
    -- Reinhard Zumkeller, Oct 08 2011
    
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[1000], countOdd[Collatz[#]] == 9 &] (* T. D. Noe, Dec 03 2012 *)
  • Python
    def a(n):
        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 len([i for i in l if i%2])
    [n for n in range(30, 1101) if a(n)==9] # Indranil Ghosh, Apr 14 2017

A092893 Smallest starting value in a Collatz '3x+1' sequence such that the sequence contains exactly n tripling steps.

Original entry on oeis.org

1, 5, 3, 17, 11, 7, 9, 25, 33, 43, 57, 39, 105, 135, 185, 123, 169, 219, 159, 379, 283, 377, 251, 167, 111, 297, 395, 263, 175, 233, 155, 103, 137, 91, 121, 161, 107, 71, 47, 31, 41, 27, 73, 97, 129, 171, 231, 313, 411, 543, 731, 487, 327, 859, 1145, 763, 1017, 1351
Offset: 0

Views

Author

Hugo Pfoertner, Mar 11 2004

Keywords

Comments

First occurrence of n in A006667.
These are the odd (primitive) terms in A129304. - T. D. Noe, Apr 09 2007
Except for a(1) = 5, all values are congruent {1, 3, 7} (mod 8). Reason: If n is 5 (mod 8) then the Collatz trajectory starting with m = (n - 1)/4 contains the same number of tripling steps, because n = 4m + 1 and the Collatz 3x + 1 step results in 3*(4m + 1) + 1 = 12m + 4 which gets reduced by halving to 3m + 1, without changing the number of tripling steps. - Ralf Stephan, Jun 19 2025

Examples

			a(4)=11 because the Collatz sequence 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 is the first sequence containing 4 tripling steps.
		

Crossrefs

Row n=1 of A354236.

Programs

  • Mathematica
    a[n_]:=Length[Select[NestWhileList[If[EvenQ[#],#/2,3#+1] &,n,#>1 &],OddQ]]; Table[i=1; While[a[i]!=n,i=i+2]; i,{n,58}] (* Jayanta Basu, May 27 2013 *)
Previous Showing 21-30 of 58 results. Next