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-10 of 11 results. Next

A075487 Length of iteration list when Collatz-function is iterated with initial value 1+3^n.

Original entry on oeis.org

2, 3, 7, 19, 111, 22, 96, 33, 76, 75, 43, 135, 134, 133, 132, 144, 205, 129, 190, 140, 95, 94, 261, 428, 91, 258, 394, 331, 255, 254, 390, 389, 388, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 501, 500, 450, 498, 497, 752, 495, 494, 493, 748, 491, 746, 489
Offset: 0

Views

Author

Labos Elemer, Sep 26 2002

Keywords

Comments

n=2, 1+3^n = 10, list = {10,5,16,8,4,2,1}, so a(2)=7

Crossrefs

Programs

  • Mathematica
    coll[n_]:=Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&]]; coll /@ (3^Range[0, 60] + 1) (* Harvey P. Dale, Dec 15 2014 *)

Formula

a(n) = A008908(3^n+1).

A074474 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of form 4n+3.

Original entry on oeis.org

7, 12, 9, 12, 7, 9, 97, 92, 7, 14, 9, 89, 7, 9, 12, 89, 7, 84, 9, 14, 7, 9, 74, 14, 7, 69, 9, 51, 7, 9, 14, 25, 7, 12, 9, 12, 7, 9, 66, 35, 7, 48, 9, 14, 7, 9, 12, 22, 7, 14, 9, 22, 7, 9, 14, 51, 7, 20, 9, 33, 7, 9, 45, 22, 7, 12, 9, 12, 7, 9, 40, 17, 7, 14, 9, 22, 7, 9, 12, 35, 7, 35, 9, 14
Offset: 1

Views

Author

Labos Elemer, Sep 19 2002

Keywords

Examples

			n=6: 4n-1=23, the list={23,70,35,106,53,160,80,40,20, 10,5,16,8,4,2,1} sinks first below iv=23 at 20, the 9th term, so a(6)=9. Observe several (provable) modular rules with respect of initial value: e.g. regular appearance of 9 and 7.
		

Crossrefs

Programs

  • Mathematica
    Table[Function[k, Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, k, # >= k &]][4 n - 1], {n, 120}] (* Michael De Vlieger, Feb 20 2017 *)

Formula

a(n)=A074473[4n-1]

A075483 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of form 64n+63.

Original entry on oeis.org

89, 25, 22, 22, 35, 20, 66, 30, 17, 38, 133, 27, 25, 40, 35, 30, 20, 25, 22, 38, 38, 133, 51, 27, 17, 40, 22, 30, 20, 35, 22, 95, 131, 33, 20, 25, 27, 22, 27, 66, 17, 27, 71, 45, 33, 48, 35, 89, 22, 33, 30, 30, 48, 22, 40, 30, 17, 61, 30, 64, 22, 22, 25, 84, 22, 22, 25, 33
Offset: 0

Views

Author

Labos Elemer, Sep 24 2002

Keywords

Comments

1stSubmergeLengths[=A074473] with initial values belonging to other residue classes modulo 64 are either listed in A075476-A075483 or can be easily determined. For 64k+2s the first sink below initial value is at 2nd iterate; for 64k+4s+1 the first submerge below initial value comes at 4th term of iteration list; finally if initial value is of 64k+4s+3 form or moreover initial value = 64k+r, r = 3, 11, 19, 23, 35, 43, 51, 55, then for all k first sink emerges at the 7th, 9th, 7th, 9th, 7th, 9th, 7th, 9th iterates, respectively.

Examples

			n=8: 64n + 63 = 575, the list = the 17th term 410 < 575 = initial value, so a(8)=17.
		

Crossrefs

Programs

  • Mathematica
    Table[Function[k, Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, k, # >= k &]][64 n - 1], {n, 120}] (* Michael De Vlieger, Feb 20 2017 *)

Formula

a(n) = A074473(64n + 63).

A075488 Length of iteration list when Collatz-function is iterated with initial value -1+3^n.

Original entry on oeis.org

2, 4, 11, 10, 97, 96, 33, 32, 44, 43, 135, 134, 133, 132, 100, 99, 191, 190, 140, 139, 262, 261, 428, 427, 395, 394, 331, 330, 391, 390, 389, 388, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 747, 746
Offset: 1

Views

Author

Labos Elemer, Sep 26 2002

Keywords

Comments

n=3, -1+3^n = 26, list = {26,13,40,20,10,5,16,8,4,2,1}, a(3)=11.

Crossrefs

Programs

  • Mathematica
    lcoll[n_] := Length[NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]]; Table[lcoll[3^i - 1], {i, 54}] (* Jayanta Basu, Jun 15 2013 *)

Formula

a(n) = A008908(3^n-1).

A075482 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of the form 64n + 59.

Original entry on oeis.org

12, 14, 12, 45, 12, 14, 12, 17, 12, 14, 12, 33, 12, 14, 12, 20, 12, 14, 12, 25, 12, 14, 12, 17, 12, 14, 12, 20, 12, 14, 12, 30, 12, 14, 12, 25, 12, 14, 12, 17, 12, 14, 12, 30, 12, 14, 12, 22, 12, 14, 12, 69, 12, 14, 12, 17, 12, 14, 12, 22, 12, 14, 12, 22, 12, 14, 12, 82, 12
Offset: 0

Views

Author

Labos Elemer, Sep 24 2002

Keywords

Comments

1stSubmergeLengths[=A074473] with initial values belonging to other residue classes modulo 64 are either listed in A075476-A075483 or can be easily determined. For 64k+2s the first sink below initial value is at 2nd iterate; for 64k+4s+1 the first submerge below initial value comes at 4th term of iteration list; finally if initial value is of 64k+4s+3 form or moreover initial value = 64k+r, r = 3, 11, 19, 23, 35, 43, 51, 55, then for all k first sink emerges at the 7th, 9th, 7th, 9th, 7th, 9th, 7th, 9th iterates, respectively.

Examples

			n=0: 64n + 59 = 59, the list = {59,178,89,268,134,67,202,101,304,152,76,38,...} the 12th term = 38 < 59 = the initial value, so a(0)=12.
		

Crossrefs

Programs

  • Mathematica
    Table[Function[m, Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, m, # >= m - 1 &]][64 n + 59], {n, 0, 84}] (* Michael De Vlieger, Mar 25 2017 *)
  • PARI
    A006370(n) = if(n%2, 3*n+1, n/2);
    A074473(n) = if(1==n,n,my(org_n=n); for(i=1,oo,if(nA006370(n)));
    A075482(n) = A074473((64*n)+59); \\ Antti Karttunen, Oct 09 2018

Formula

a(n) = A074473(64n + 59).

A075484 Length of iteration-list when Collatz-function(A006370) is iterated with initial value 5^n.

Original entry on oeis.org

1, 6, 24, 109, 26, 124, 147, 139, 100, 92, 115, 337, 135, 277, 181, 261, 240, 219, 286, 322, 451, 337, 303, 432, 243, 540, 408, 444, 304, 464, 438, 554, 484, 582, 517, 677, 462, 617, 1002, 539, 655, 709, 714, 737, 623, 708, 868, 723, 707, 676, 642, 833, 776
Offset: 0

Views

Author

Labos Elemer, Sep 26 2002

Keywords

Examples

			n=2: 5^n=25, list={25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10.5, 16, 8, 4, 2, 1}, a(2)=24.
		

Crossrefs

Programs

  • Mathematica
    Table[Length[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, 5^n, # != 1 &]], {n, 0, 52}] (* Michael De Vlieger, Feb 25 2017 *)

Formula

a(n) = A008908(5^n).

A075486 Length of iteration list when Collatz-function is iterated with initial value 2^n + 1.

Original entry on oeis.org

8, 6, 20, 13, 27, 28, 122, 123, 36, 37, 157, 114, 53, 54, 99, 100, 101, 102, 103, 73, 167, 168, 169, 170, 171, 172, 248, 174, 188, 189, 252, 253, 179, 180, 318, 244, 196, 197, 154, 155, 156, 157, 401, 327, 496, 497, 162, 163, 332, 333, 409, 472, 411, 412, 338
Offset: 1

Views

Author

Labos Elemer, Sep 26 2002

Keywords

Comments

n=4, 1+2^n = 17, list = {17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1}, so a(4) = 13.

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Table[Length[Collatz[2^n + 1]], {n, 100}] (* T. D. Noe, Jan 17 2013 *)

Formula

a(n) = A008908(2^n+1).

A179118 Number of Collatz steps to reach 1 starting with 2^n + 1.

Original entry on oeis.org

1, 7, 5, 19, 12, 26, 27, 121, 122, 35, 36, 156, 113, 52, 53, 98, 99, 100, 101, 102, 72, 166, 167, 168, 169, 170, 171, 247, 173, 187, 188, 251, 252, 178, 179, 317, 243, 195, 196, 153, 154, 155, 156, 400, 326, 495, 496, 161, 162, 331, 332, 408, 471, 410, 411, 337, 338, 339, 340, 553
Offset: 0

Views

Author

Mitch Harris, Jan 04 2011

Keywords

Comments

There are many long runs of consecutive terms that increase by 1 (see second conjecture in A277109). For n < 40000, the longest run has 1030 terms starting from a(33237) = 244868 and ending with a(34266) = 245897. - Dmitry Kamenetsky, Sep 30 2016

Examples

			a(1)=7 because the trajectory of 2^1+1=3 is (3,10,5,16,8,4,2,1).
		

Crossrefs

Cf. A000051, A006577, A070976, A074472, A075486, A193688 (starting with 2^n-1), , A179118, A277109.

Programs

  • Mathematica
    CollatzNext[n_] := If[Mod[n, 2] == 0, n/2, 3 n + 1]; CollatzPath[n_] := CollatzPath[n] = Module[{k = n, l = {}}, While[k != 1, k = CollatzNext[k]; l = Append[l, k]]; l]; Collatz[n_] := Length[CollatzPath[n]]; Table[Collatz[2^n+1],{n,1,50}]
    f[n_] := Length@ NestWhileList[If[OddQ@ #, 3 # + 1, #/2] &, 2^n + 1, # > 1 &] - 1; Array[f, 60] (* Robert G. Wilson v, Jan 05 2011 *)
    Array[-1 + Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, 2^# + 1, # > 1 &] &, 60, 0] (* Michael De Vlieger, Nov 25 2018 *)
  • PARI
    nbsteps(n)= s=n; c=0; while(s>1, s=if(s%2, 3*s+1, s/2); c++); c;
    a(n) = nbsteps(2^n+1); \\ Michel Marcus, Oct 28 2018
  • Python
    def steps(a):
      if a==1:     return 0
      elif a%2==0: return 1+steps(a//2)
      else:        return 1+steps(a*3+1)
    for n in range(60):
      print(n, steps((1<
    				

Formula

a(n) = A006577(2^n+1) = A006577(A000051(n)).
a(n) = A075486(n) - 1. - T. D. Noe, Jan 17 2013

Extensions

a(0)=1 prepended by Alois P. Heinz, Dec 12 2018

A070976 Number of steps to reach 1 in '3x+1' (or Collatz) problem starting with 3^n.

Original entry on oeis.org

0, 7, 19, 111, 22, 96, 33, 76, 75, 43, 135, 134, 133, 132, 144, 205, 129, 190, 140, 95, 94, 261, 428, 91, 258, 394, 331, 255, 254, 390, 389, 388, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 501, 500, 450, 498, 497, 752, 495, 494, 493, 748, 491, 746, 489
Offset: 0

Views

Author

Benoit Cloitre, May 17 2002

Keywords

Comments

For all n, it appears that a(n) <= 37n. For n > 22, it appears that a(n) < 16n. - T. D. Noe, Feb 02 2007
This sequence contains some unusually long runs of values that differ by 1. - Dmitry Kamenetsky, Dec 09 2016

Examples

			For n=4, 3^4 = 81, and the Collatz sequence (3x + 1 if odd, x/2 if even) goes 81, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1.  This is 22 steps, so a(4) = 22. - _Michael B. Porter_, Dec 15 2016
		

Crossrefs

Cf. A279269, A277109. Equals A006577(3^n).

Programs

  • Mathematica
    Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,3^n,#>1&]]-1, {n,0,60}] (* Harvey P. Dale, Oct 13 2011 *)
  • PARI
    for(n=2,100,s=3^n; t=0; while(s!=1,t++; if(s%2==0,s=s/2,s=3*s+1); if(s==1,print1(t,","); ); ))

Formula

a(n) = A075487(n+1) = A074472(n) + 1. - T. D. Noe, Feb 02 2007

A075485 Length of iteration list when Collatz-function is iterated with initial value 2^n - 1.

Original entry on oeis.org

1, 8, 17, 18, 107, 108, 47, 48, 62, 63, 157, 158, 159, 160, 130, 131, 225, 226, 178, 179, 304, 305, 474, 475, 445, 446, 385, 386, 449, 450, 451, 452, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 853, 854
Offset: 1

Views

Author

Labos Elemer, Sep 26 2002

Keywords

Comments

Somewhat surprisingly, these iterations take almost twice as long as the iterations for 2^n + 1. See A075486. - T. D. Noe, Jan 17 2013

Examples

			n=4, 2^n - 1 = 15, list = {15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1}, so a(4) = 18.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Table[Length[Collatz[2^n - 1]], {n, 100}] (* T. D. Noe, Jan 17 2013 *)

Formula

a(n) = A008908(2^n-1).
Showing 1-10 of 11 results. Next