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.

A199636 Irregular rows of odd numbers that produce n even numbers in their Collatz iteration.

Original entry on oeis.org

5, 3, 21, 13, 85, 17, 53, 11, 35, 113, 341, 7, 23, 69, 75, 213, 227, 15, 45, 141, 151, 453, 1365, 9, 29, 93, 277, 301, 853, 909, 19, 61, 181, 201, 565, 605, 1813, 5461, 37, 117, 369, 373, 401, 403, 1109, 1137, 1205, 3413, 3637, 25, 77, 81, 241, 245, 267, 725
Offset: 4

Views

Author

T. D. Noe, Nov 14 2011

Keywords

Comments

It is conjectured that every odd number greater than 1 eventually appears in this sequence. The smallest and largest terms in row n are A199637(n) and A199638(n). The number of terms in row n is A131450(n) for n > 3.
The 10th and 20th rows are A199817 and A199818.

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 16; t = Table[{}, {nn}]; Do[len = Length[Select[Collatz[n], EvenQ]]; If[0 < len <= nn, AppendTo[t[[len]], n]], {n, 1, 25000, 2}]; t

A060322 Consider the version of the Collatz or 3x+1 problem where x -> x/2 if x is even, x -> (3x+1)/2 if x is odd. Define the stopping time of x to be the number of steps needed to reach 1. Sequence gives the number of integers x with stopping time n.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 4, 5, 6, 8, 12, 18, 24, 31, 39, 50, 68, 91, 120, 159, 211, 282, 381, 505, 665, 885, 1187, 1590, 2122, 2829, 3765, 5014, 6682, 8902, 11878, 15844, 21122, 28150, 37536, 50067, 66763, 89009, 118631, 158171, 210939, 281334, 375129, 500106, 666725
Offset: 1

Views

Author

Bo T. Ahlander (ahlboa(AT)isk.kth.se), Mar 29 2001

Keywords

Comments

The Mathematica function StoppingTime[n] is the length of the Collatz sequence starting at n before reaching 1.
Suppose we have a list L of the numbers with StoppingTime n. Then the list LL of StoppingTime n+1 can be produced as: First. Add to LL all numbers in L multiplied by 2. Second. For the numbers x now in LL, if x == 1 (mod 3), AppendTo LL the number (x-1)/3 (if (x-1)/3 != 1). These two steps make LL complete.
I think the offset, examples, formula and code are all off by 1 -- they all treat the stopping time of 1 to be 1, rather than 0. - David Applegate, Oct 16 2008
a(n+1), n >= 0, is the row length of A248573(n,m) (Collatz-Terras tree). For the first differences see A131450(n+1), but with A131450(2) = 1 (the number of 2 (mod 3) numbers in row n, for n >= 0, of A248573). - Wolfdieter Lang, May 04 2015

Examples

			StoppingTime = 1: L = {1}, a(1)=1.
StoppingTime = 2: L = {2}, a(2)=1.
StoppingTime = 3: L = {4}, a(3)=1.
StoppingTime = 4: L = {8}, a(4)=1.
StoppingTime = 5: L = {5, 16}, a(5)=2. First, LL = {10, 32} (= 2*L). Second, 10 == 1 (mod 3), so we AppendTo LL also (10-1)/3 = 3. We get LL = {3, 10, 32}. So a(6) = 3.
		

Crossrefs

See A005186 for another version.

Programs

  • Mathematica
    (*** Program #1 ***) For[v = 1, v <= 12, v++, lst = {}; For[n = 1, n < 2^v, n++, If[StoppingTime[n] == v, AppendTo[lst, n]]]; Print[lst]; Print[Length[lst]]; ]
    (*** Program #2 ***) lst1 = {1}; For[v = 1, v <= 12, v++, L1 = Length[lst1]; Print["Number of numbers with StoppingTime ", v, ": ", L1]; Print["List of numbers: ", lst1]; (* Numbers with StoppingTime n *) Print["Control of StoppingTime: ", Map[StoppingTime, lst1]]; (* Controll *) Print[""]; lst2 = 2 lst1; For[i = 1, i <= L1, i++, x = (lst2[[i]] - 1)/3; If[IntegerQ[x] && x != 1, AppendTo[lst2, x]]; ]; lst1 = Sort[lst2]; ]
    (*** Program #3 ***) lst0 = {}; lst1 = {1}; For[v = 1, v <= 35, v++, L1 = Length[lst1]; AppendTo[lst0, L1]; lst2 = 2 lst1; For[i = 1, i <= L1, i++, x = (lst2[[i]] - 1)/3; If[IntegerQ[x], AppendTo[lst2, x]]; ]; lst1 = Complement[lst2, {1}]; ]; lst0
  • PARI
    first(N) = my(a=Vec([1, 1, 1, 1, 2], N), p=[], q=[5]); for(n=6, N, my(r=List()); foreach(p, x, listput(r, 4*x+1); if(1==x%6, listput(r, x+(x-1)/3))); foreach(q, x, if(5==x%6, listput(r, x-(x+1)/3))); a[n]=a[n-1]+#r; p=q; q=Vec(r)); a; \\ Ruud H.G. van Tol, Aug 14 2024
  • Perl
    # code to calculate terms after a(4):
    @x=(8,0);for($n=5;$n<=60;$n++){do{$q=2*shift(@x);push(@x,($q-1)/3)if($q%3==1);push @x,$q}while $q;print($#x,", ");} # Carl R. White, Oct 03 2006
    

Formula

Conjecture: lim_{n->oo} a(n) = a(n-1)*4/3. - Joe Slater, Jan 27 2024

Extensions

More terms from Carl R. White, Oct 03 2006
Edited by N. J. A. Sloane, Sep 15 2007
More terms from Joe Slater, Apr 10 2025

A166549 The number of halving steps of the Collatz 3x+1 map to reach 1 starting from 2n-1.

Original entry on oeis.org

0, 5, 4, 11, 13, 10, 7, 12, 9, 14, 6, 11, 16, 70, 13, 67, 18, 10, 15, 23, 69, 20, 12, 66, 17, 17, 9, 71, 22, 22, 14, 68, 19, 19, 11, 65, 73, 11, 16, 24, 16, 70, 8, 21, 21, 59, 13, 67, 75, 18, 18, 56, 26, 64, 72, 45, 10, 23, 15, 23, 61, 31, 69, 31, 77, 20, 20, 28, 58, 28, 12, 66, 74, 74, 17
Offset: 1

Views

Author

Jimin Park, Oct 16 2009

Keywords

Comments

A given term k appears A131450(k) times. - Flávio V. Fernandes, Mar 13 2022

Crossrefs

Programs

  • Maple
    A006370 := proc(n) if type(n,'even') then n/2; else 3*n+1 ; end if; end proc:
    A006577 := proc(n) a := 0 ; x := n ; while x > 1 do x := A006370(x) ; a := a+1 ; end do; a ; end proc:
    A006667 := proc(n) a := 0 ; x := n ; while x > 1 do if type(x,'even') then x := x/2 ; else x := 3*x+1 ; a := a+1 ; end if; end do; a ; end proc:
    A075680 := proc(n) A006667(2*n-1) ; end proc:
    A166549 := proc(n) A006577(2*n-1)-A075680(n) ; end: seq(A166549(n),n=1..120) ; # R. J. Mathar, Oct 18 2009
    # second Maple program:
    b:= proc(n) option remember; `if`(n=1, 0,
          1+b(`if`(n::even, n/2, (3*n+1)/2)))
        end:
    a:= n-> b(2*n-1):
    seq(a(n), n=1..75);  # Alois P. Heinz, Mar 14 2022
  • Mathematica
    b[n_] := b[n] = If[n == 1, 0, 1 + b[If[EvenQ[n], n/2, (3n+1)/2]]];
    a[n_] := b[2n-1];
    Table[a[n], {n, 1, 75}] (* Jean-François Alcover, Apr 22 2022, after Alois P. Heinz *)

Formula

a(n) = A006577(2n-1) - A075680(n).

Extensions

Edited and extended by R. J. Mathar, Oct 18 2009

A199817 Odd numbers producing 10 even numbers in the Collatz iteration.

Original entry on oeis.org

11, 35, 113, 341
Offset: 1

Views

Author

Vincenzo Librandi, Nov 12 2011

Keywords

Crossrefs

Cf. A131450.
Cf. A199636 (row 10).

Programs

  • Mathematica
    Collatz[n_]:=NestWhileList[If[EvenQ[#],#/2,3 #+1]&,n,#>1&];t={};Do[If[Length[Select[Collatz[n],EvenQ]] == 10,AppendTo[t,n]],{n,1,100000,2}];t

A199818 Odd numbers producing 20 even numbers in the Collatz iteration.

Original entry on oeis.org

43, 131, 133, 397, 405, 433, 435, 441, 475, 1237, 1251, 1285, 1301, 1313, 1325, 1339, 1425, 1427, 1431, 1433, 3861, 3925, 3939, 3941, 3981, 4017, 4019, 4043, 4277, 4293, 4297, 4301, 11605, 11829, 12053, 12131, 12133, 12853, 12885, 12893, 12913, 12931, 36181
Offset: 1

Views

Author

Vincenzo Librandi, Nov 12 2011

Keywords

Comments

For n <10000000, more terms: 36405, 38677, 38741, 38797, 38833, 38835, 116053, 116501, 349525.
See row 20 of A199636. There are A131450(20) = 52 terms. - T. D. Noe, Nov 18 2011

Crossrefs

Cf. A199636.

Programs

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