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-3 of 3 results.

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).

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

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-3 of 3 results.