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

A277684 Least k such that A277109(k) = 2^n - 1.

Original entry on oeis.org

0, 6, 17, 18, 69, 70, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 464, 465, 466, 467, 624, 625, 1810, 1811, 1812
Offset: 1

Views

Author

Dmitry Kamenetsky, Oct 26 2016

Keywords

Comments

Are the terms always increasing? Note, if the conjecture in A277109 is true then the terms in this sequence are guaranteed to be increasing.
Since the conjecture in A277109 is true, this sequence is strictly increasing. - Hartmut F. W. Hoft, Aug 16 2018

Examples

			Since A277109(69) = 15 is the first occurrence of 15 = 2^4 - 1, a(4) = 69. - _Hartmut F. W. Hoft_, Aug 16 2018
		

Crossrefs

Cf. A277109.

Programs

  • Mathematica
    collatzN[n_] := Length[NestWhileList[If[EvenQ[#], #/2, 3# + 1]&, n, #!=1&]]
    collatzNrun[n_] := Module[{run=collatzN[n], k=1}, While[collatzN[n+k]==run, k++]; k]
    power2[k_] := Module[{list=NestWhileList[#/2&, k, EvenQ]}, {Last[list], Length[list]-1}]
    (* a277684[] computes all values through index n *)
    a277684[n_] := Module[{i, list={0}}, For[i=1, i<=n, i++, If[power2[collatzNrun[2^i+1]+1] == {1, Length[list]+1}, AppendTo[list, i]]]; list]/;n>0 (* Hartmut F. W. Hoft, Aug 16 2018 *)
  • PARI
    nbsteps(n)= s=n; c=0; while(s>1, s=if(s%2, 3*s+1, s/2); c++); c;
    len(n) = {my(ns = 2^n+1); my(nbs = nbsteps(ns)); while(nbsteps(ns+1) == nbs, ns++); ns - 2^n;}
    a(n) = {k=0; while(len(k) != 2^n-1, k++); k;} \\ Michel Marcus, Oct 30 2016

Extensions

Duplicated term 300 removed by Hartmut F. W. Hoft, Aug 16 2018

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

A280341 Number of distinct heights achieved in the Collatz (or '3x+1') problem when starting from numbers in the range [2^n,2^(n+1)).

Original entry on oeis.org

1, 2, 4, 6, 10, 16, 26, 41, 53, 64, 74, 85, 101, 118, 128, 144, 157, 174, 195, 217, 238, 261, 281, 309, 324, 342, 364, 397
Offset: 0

Views

Author

Dmitry Kamenetsky, Jan 01 2017

Keywords

Comments

Here the height is defined to be the number of halving and tripling steps required to reach 1.
Interestingly the values in this sequence grow slowly (almost linearly) indicating that the average number of starting values with the same height increases with n.
Question: Is this sequence always increasing?
Definition corrected by N. J. A. Sloane, Apr 09 2020. The old definition was "Number of unique heights achieved in the Collatz (or '3x+1') problem when starting from numbers in the range [2^n,2^(n+1))."
This sequence a(n) as well as the sequence of maximum heights in each interval appear to increase quadratically with n. The odd numbers in [2^n, 2^(n+1)) , 5 <= n <= 20, create all distinct heights for the interval except for height n of number 2^n, and except for height n+3 when n is odd. - Hartmut F. W. Hoft, Dec 16 2020

Examples

			The heights for starting values 16 to 31 are: 4, 12, 20, 20, 7, 7, 15, 15, 10, 23, 10, 111, 18, 18, 18, 106. The unique heights are: 4, 12, 20, 7, 15, 10, 23, 111, 18, 106. Hence a(4)=10.
		

Crossrefs

Programs

  • Mathematica
    collatz[n_] := If[EvenQ[n], n/2, 3n+1]
    height[n_] := Length[NestWhileList[collatz, n, #!=1&]] - 1
    a280341[n_] := Length[Union[Map[height, Range[2^n, 2^(n+1)-1]]]]
    (* sequence data; long computation times for n >= 22 *)
    Map[a280341, Range[0, 27]]
    (* Hartmut F. W. Hoft, Dec 16 2020 *)

Extensions

a(25)-a(27) from Hartmut F. W. Hoft, Dec 16 2020

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

A339769 Number of unique heights that are achieved by only one starting number in the Collatz (or '3x+1') problem when starting from numbers in the range [2^n, 2^(n+1)).

Original entry on oeis.org

1, 2, 4, 4, 5, 6, 10, 12, 9, 7, 4, 9, 13, 11, 7, 6, 8, 10, 13, 14, 10, 15, 14, 21, 8, 7, 13, 21
Offset: 0

Views

Author

Hartmut F. W. Hoft, Dec 16 2020

Keywords

Comments

The number of unique heights in each interval [2^n, 2^(n+1)) appears to be linear in n - with large oscillations about the best fit line - while the values of attained maximum heights appear to be quadratic in n.
Neither this sequence nor the corresponding sequence of maximum heights in each interval is monotone, e.g.: a(23..27) = (21, 8, 7, 13, 21) and the corresponding maximum heights are (704, 702, 949, 947, 956).

Examples

			a(5)=6 since the 6 heights 5, 26, 34, 109, 29, 104 are uniquely attained from the starting numbers 32, 33, 39, 41, 43, 47, respectively. The largest of the distinct heights (A280341) in the interval [32,64) however is 112.
a(11)=9 with largest unique height 237 for starting value 3711 in interval [2^11, 2^12) also is the largest height for all starting values in the interval.
		

Crossrefs

Programs

  • Mathematica
    collatz[n_] := If[EvenQ[n], n/2, 3n+1]
    height[n_] := Length[NestWhileList[collatz, n, #!=1&]] - 1
    a339769[n_] := Module[{heightL={}, countL={}, s, h, p}, For[s=2^n, s<2^(n+1), s++, h=height[s]; If[!MemberQ[heightL, h], AppendTo[heightL, h]; AppendTo[countL, 1], {{p}}=Position[heightL, h]; countL[[p]]+=1]]; Length[Select[Transpose[{heightL, countL}], #[[2]]==1&]]]
    (* sequence data; long computation times for n >= 22 *)
    Map[a339769, Range[0, 27]]

A346775 Starting from n!+1, the length of the longest sequence of consecutive numbers which all take the same number of steps to reach 1 in the Collatz (or '3x+1') problem.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 3, 5, 1, 7, 1, 1, 3, 1, 3, 1, 1, 1, 30, 1, 30, 3, 7, 1, 3, 3, 7, 1, 1, 7, 15, 3, 1, 1, 3, 15, 26, 15, 1, 1, 1, 1, 7, 7, 26, 7, 1, 7, 3, 1, 1, 3, 1, 7, 3, 7, 1, 1, 26, 15, 7, 30, 1, 1, 1, 1, 3, 15, 3, 1, 1, 31, 648, 26, 26, 30, 90, 1, 1, 3, 15
Offset: 0

Views

Author

Dmitry Kamenetsky, Aug 03 2021

Keywords

Comments

The largest value known in this sequence is a(219)=78553595.
2^32 < a(238) < 11442739136455298475. - Martin Ehrenstein, Aug 21 2021
Jeremy Sawicki found that a(238) = 107150589645. - Dmitry Kamenetsky, Aug 25 2024

Examples

			a(6) = 3, because 6!+1, 6!+2 and 6!+3 all take 46 steps to reach 1, while 6!+4 requires 20 steps to reach 1.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Length[NestWhileList[If[EvenQ@#, #/2, 3 # + 1] &, n, # != 1 &]] - 1; Table[k = 1; While[f[n! + k] == f[n! + k + 1], k++]; k, {n, 0, 100}] (* Bence Bernáth, Aug 14 2021 *)
  • PARI
    a6577(n0)={my(n=n0,k=0);while(n>1,k++;n=if(n%2,3*n+1,n/2));k};
    for(n=0,80,my(n0=n!+1,nc=a6577(n0),k=1);while(a6577(n0++)==nc,k++);print1(k,", ")) \\ Hugo Pfoertner, Aug 04 2021

A341362 a(n) begins the first sequence of n consecutive positive integers with the same h-value and the same d-value in the Collatz (or '3x + 1') problem.

Original entry on oeis.org

1, 54, 108, 290, 290, 386, 172146, 298200, 596400, 596400, 596400, 795201, 795201, 2849196, 2849196, 8965036, 33659819, 45529226, 52417676, 93186987, 104161282, 104161282, 104161282, 436089218, 436089218, 605581697, 934358530, 934358530, 934358530, 3826876112
Offset: 1

Views

Author

Lamine Ngom, Feb 10 2021

Keywords

Comments

The Collatz function is as follows: F(x) = x/2 if x is even, otherwise F(x) = 3*x+1.
It is conjectured that starting from any number, and repeatedly applying the function on its previous result, we will always reach 1.
The d-value (or flight duration, A006577) is the number of steps needed to reach 1. The h-value (or flight height, A025586) is the maximum of the number's trajectory.

Examples

			a(3) = 108 because 108, 109 and 110 have same d-value (113) and same h-value (9232).
And 108 is the smallest number starting such sequence of 3 consecutive positive integers with same d-value and same h-value.
		

Crossrefs

Cf. A078441, A277109, A268253, A006577 (duration), A025586 (height), A056959.
Showing 1-7 of 7 results.