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 24 results. Next

A006885 Record highest point of trajectory before reaching 1 in '3x+1' problem, corresponding to starting values in A006884.

Original entry on oeis.org

1, 2, 16, 52, 160, 9232, 13120, 39364, 41524, 250504, 1276936, 6810136, 8153620, 27114424, 50143264, 106358020, 121012864, 593279152, 1570824736, 2482111348, 2798323360, 17202377752, 24648077896, 52483285312, 56991483520, 90239155648, 139646736808
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.
Record values in A025586: a(n) = A025586(A006884(n)) and A025586(m) < a(n) for m < A006884(n). - Reinhard Zumkeller, May 11 2013
In an email of Aug 06 2023, Guy Chouraqui observes that the digital root of a(n) appears to be 7 for all n > 2. - N. J. A. Sloane, Aug 11 2023

References

  • R. B. Banks, Slicing Pizzas, Racing Turtles and Further Adventures in Applied Mathematics, Princeton Univ. Press, 1999. See p. 96.
  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
  • G. T. Leavens and M. Vermeulen, 3x+1 search problems, Computers and Mathematics with Applications, 24 (1992), 79-99.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006885 = a025586 . a006884  -- Reinhard Zumkeller, May 11 2013
  • Mathematica
    mcoll[n_]:=Max@@NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>=n&]; t={1,max=2}; Do[If[(y=mcoll[n])>max,AppendTo[t,max=y]],{n,3,10^6,4}]; t (* Jayanta Basu, May 28 2013 *)

A060410 In the '3x+1' problem, take the sequence of starting values which set new records for the highest point of the trajectory before reaching 1 (A006884); sequence gives associated maximal value reached in the trajectory with that start.

Original entry on oeis.org

2, 8, 26, 80, 4616, 6560, 19682, 20762, 125252, 638468, 3405068, 4076810, 13557212, 25071632, 53179010, 60506432, 296639576, 785412368, 1241055674, 1399161680, 8601188876, 12324038948, 26241642656, 28495741760
Offset: 1

Views

Author

N. J. A. Sloane, Apr 06 2001

Keywords

Crossrefs

A060409 In the '3x+1' problem, take the sequence of starting values which set new records for the highest point of the trajectory before reaching 1 (A006884); sequence gives associated "dropping time", number of steps to reach a lower value than the start.

Original entry on oeis.org

1, 4, 7, 7, 59, 13, 40, 23, 81, 61, 70, 65, 54, 72, 65, 59, 127, 105, 110, 59, 72, 164, 140, 73, 170, 105, 149, 97, 135, 183, 99, 99, 124, 156, 200, 140, 222, 264, 181, 243, 203, 238, 262, 362, 249, 183, 238, 226, 243, 294, 375, 455, 292, 245, 414
Offset: 1

Views

Author

N. J. A. Sloane, Apr 06 2001; b-file added Nov 27 2007

Keywords

Crossrefs

A060411 In the '3x+1' problem, take the sequence of starting values which set new records for the highest point of the trajectory before reaching 1 (A006884); sequence gives iterate where maximal value is reached in the trajectory with that start.

Original entry on oeis.org

0, 2, 3, 4, 45, 8, 31, 14, 48, 28, 49, 33, 26, 50, 35, 43, 67, 39, 69, 39, 35, 124, 83, 37, 132, 46, 81, 75, 83, 118, 68, 42, 72, 97, 98, 75, 92, 199, 109, 92, 92, 160, 91, 197, 119, 113, 109, 124, 176, 217, 234, 276, 172, 164, 233, 101, 109, 158, 157
Offset: 1

Views

Author

N. J. A. Sloane, Apr 06 2001; b-file added Nov 27 2007

Keywords

Crossrefs

A132348 Lengths of the 3x+1 trajectories associated with the record values in A006884.

Original entry on oeis.org

0, 1, 7, 16, 17, 111, 47, 97, 131, 170, 161, 201, 170, 184, 255, 307, 160, 334, 231, 247, 162, 183, 406, 441, 242, 439, 328, 367, 370, 427, 430, 399, 363, 322, 573, 400, 483, 576, 606, 483, 572, 438, 475, 592, 770, 726, 543, 836, 555, 770, 871, 796, 1109, 755
Offset: 1

Views

Author

N. J. A. Sloane, Nov 10 2007

Keywords

References

  • R. B. Banks, Slicing Pizzas, Racing Turtles and Further Adventures in Applied Mathematics, Princeton Univ. Press, 1999. See p. 96.

Crossrefs

Formula

a(n) = A006577(A006884(n)). - Hugo Pfoertner, Jan 13 2025

Extensions

Extended by T. D. Noe, Apr 27 2010

A365482 In the Collatz (3x+1) problem, values in A006884 for which the maximum excursion ratio (see comments) is greater than 2.

Original entry on oeis.org

27, 319804831, 1410123943, 3716509988199, 9016346070511, 1254251874774375, 10709980568908647, 1980976057694848447
Offset: 1

Views

Author

Paolo Xausa, Sep 05 2023

Keywords

Comments

Kontorovich and Lagarias (2009, 2010) define the maximum excursion ratio as the ratio between the log of the highest point in the trajectory of the T function (started at x) and the log of x, where T(x) is the 3x+1 function = (3x+1)/2 if x is odd, x/2 if x is even (A014682).
They use data from Oliveira e Silva (2010) to compile Table 3 in their paper, but they omit the a(7) = 10709980568908647 value (cf. also Barina and Roosendall links).
Equivalently, values in A006884 for which A365478(A006884(k)) / A006884(k)^2 > 1, for k >= 1.
See A365483 for corresponding maximum excursion values.

Crossrefs

Subsequence of A006884.

A025586 Largest value in '3x+1' trajectory of n.

Original entry on oeis.org

1, 2, 16, 4, 16, 16, 52, 8, 52, 16, 52, 16, 40, 52, 160, 16, 52, 52, 88, 20, 64, 52, 160, 24, 88, 40, 9232, 52, 88, 160, 9232, 32, 100, 52, 160, 52, 112, 88, 304, 40, 9232, 64, 196, 52, 136, 160, 9232, 48, 148, 88, 232, 52, 160, 9232, 9232, 56, 196, 88, 304, 160, 184, 9232
Offset: 1

Views

Author

Keywords

Comments

Here by definition the trajectory ends when 1 is reached. Therefore this sequence differs for n = 1 and n = 2 from A056959, which considers the orbit ending in the infinite loop 1 -> 4 -> 2 -> 1.
a(n) = A220237(n,A006577(n)). - Reinhard Zumkeller, Jan 03 2013
A006885 and A006884 give record values and where they occur. - Reinhard Zumkeller, May 11 2013
For n > 2, a(n) is divisible by 4. See the explanatory comment in A056959. - Peter Munn, Oct 14 2019
In an email of Aug 06 2023, Guy Chouraqui observes that the digital root of a(n) appears to be either 7 or a multiple of 4 for all n > 2. (See also A006885.) - N. J. A. Sloane, Aug 11 2023

Examples

			The 3x + 1 trajectory of 9 is 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 (see A033479). Since the largest number in that sequence is 52, a(9) = 52.
		

Crossrefs

Essentially the same as A056959: only a(1) and a(2) differ, see Comments.

Programs

  • Haskell
    a025586 = last . a220237_row
    -- Reinhard Zumkeller, Jan 03 2013, Aug 29 2012
    
  • Maple
    a:= proc(n) option remember; `if`(n=1, 1,
          max(n, a(`if`(n::even, n/2, 3*n+1))))
        end:
    seq(a(n), n=1..87);  # Alois P. Heinz, Oct 16 2021
  • Mathematica
    collatz[a0_Integer, maxits_:1000] := NestWhileList[If[EvenQ[#], #/2, 3# + 1] &, a0, Unequal[#, 1, -1, -10, -34] &, 1, maxits]; (* collatz[n] function definition by Eric Weisstein *) Flatten[Table[Take[Sort[Collatz[n], Greater], 1], {n, 60}]] (* Alonso del Arte, Nov 14 2007 *)
    collatzMax[n_] := Module[{r = m = n}, While[m > 2, If[OddQ[m], m = 3 * m + 1; If[m > r, r = m], m = m/2]]; r]; Table[ collatzMax[n], {n, 100}] (* Jean-François Alcover, Jan 28 2015, after Charles R Greathouse IV *)
    (* Using Weisstein's collatz[n] definition above *) Table[Max[collatz[n]], {n, 100}] (* Alonso del Arte, May 25 2019 *)
  • PARI
    a(n)=my(r=n);while(n>2,if(n%2,n=3*n+1;if(n>r,r=n),n/=2));r \\ Charles R Greathouse IV, Jul 19 2011
    
  • Python
    def a(n):
        if n<2: return 1
        l=[n, ]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            if not n in l:
                l+=[n, ]
                if n<2: break
            else: break
        return max(l)
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 14 2017
    
  • Scala
    def collatz(n: Int): Int = (n % 2) match {
      case 0 => n / 2
      case 1 => 3 * n + 1
    }
    def collatzTrajectory(start: Int): List[Int] = if (start == 1) List(1)
    else {
      import scala.collection.mutable.ListBuffer
      var curr = start; var trajectory = new ListBuffer[Int]()
      while (curr > 1) { trajectory += curr; curr = collatz(curr) }
      trajectory.toList
    }
    for (n <- 1 to 100) yield collatzTrajectory(n).max // Alonso del Arte, Jun 02 2019

A006877 In the '3x+1' problem, these values for the starting value set new records for number of steps to reach 1.

Original entry on oeis.org

1, 2, 3, 6, 7, 9, 18, 25, 27, 54, 73, 97, 129, 171, 231, 313, 327, 649, 703, 871, 1161, 2223, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 23529, 26623, 34239, 35655, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935, 626331, 837799
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.
This sequence without a(2) = 2 specifies where records occur in A208981. - Omar E. Pol, Apr 14 2022

References

  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    A006877 := proc(n) local a,L; L := 0; a := n; while a <> 1 do if a mod 2 = 0 then a := a/2; else a := 3*a+1; fi; L := L+1; od: RETURN(L); end;
  • Mathematica
    numberOfSteps[x0_] := Block[{x = x0, nos = 0}, While [x != 1 , If[Mod[x, 2] == 0 , x = x/2, x = 3*x + 1]; nos++]; nos]; a[1] = 1; a[n_] := a[n] = Block[{x = a[n-1] + 1}, record = numberOfSteps[x - 1]; While[ numberOfSteps[x] <= record, x++]; x]; A006877 = Table[ Print[a[n]]; a[n], {n, 1, 44}](* Jean-François Alcover, Feb 14 2012 *)
    DeleteDuplicates[Table[{n,Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]]},{n,838000}],GreaterEqual[#1[[2]],#2[[2]]]&][[All,1]] (* Harvey P. Dale, May 13 2022 *)
  • PARI
    A006577(n)=my(s);while(n>1,n=if(n%2,3*n+1,n/2);s++);s
    step(n,r)=my(t);forstep(k=bitor(n,1),2*n,2,t=A006577(k);if(t>r,return([k,t])));[2*n,r+1]
    r=0;print1(n=1);for(i=1,100,[n,r]=step(n,r); print1(", "n)) \\ Charles R Greathouse IV, Apr 01 2013
    
  • Python
    c1 = lambda x: (3*x+1 if (x%2) else x>>1)
    r = -1
    for n in range(1, 10**5):
        a=0 ; n1=n
        while n>1: n=c1(n); a+=1;
        if a > r: print(n1, end = ', '); r=a
    print('...') # Ya-Ping Lu and Robert Munafo, Mar 22 2024

A006878 Record number of steps to reach 1 in '3x+1' problem, corresponding to starting values in A006877.

Original entry on oeis.org

0, 1, 7, 8, 16, 19, 20, 23, 111, 112, 115, 118, 121, 124, 127, 130, 143, 144, 170, 178, 181, 182, 208, 216, 237, 261, 267, 275, 278, 281, 307, 310, 323, 339, 350, 353, 374, 382, 385, 442, 448, 469, 508, 524, 527, 530, 556, 559, 562, 583, 596, 612, 664, 685, 688, 691, 704
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.

References

  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
  • G. T. Leavens and M. Vermeulen, 3x+1 search problems, Computers and Mathematics with Applications, 24 (1992), 79-99.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    f := proc(n) local a,L; L := 0; a := n; while a <> 1 do if a mod 2 = 0 then a := a/2; else a := 3*a+1; fi; L := L+1; od: RETURN(L); end;
  • Mathematica
    numberOfSteps[x0_] := Block[{x = x0, nos = 0}, While[x != 1, If[Mod[x, 2] == 0, x = x/2, x = 3*x+1]; nos++]; nos]; A006878 = numberOfSteps /@ A006877 (* Jean-François Alcover, Feb 22 2012 *)
    DeleteDuplicates[Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]],{n,0,10^6}],GreaterEqual]-1 (* The program generates the first 44 terms of the sequence, derived from all starting values from 1 up to and including 1 million. *) (* Harvey P. Dale, Nov 26 2022 *)

A033492 Record number of steps to reach 1 in '3x+1' problem, corresponding to starting values in A006877 (same as A006878 except here we start counting at 1 instead of 0).

Original entry on oeis.org

1, 2, 8, 9, 17, 20, 21, 24, 112, 113, 116, 119, 122, 125, 128, 131, 144, 145, 171, 179, 182, 183, 209, 217, 238, 262, 268, 276, 279, 282, 308, 311, 324, 340, 351, 354, 375, 383, 386, 443, 449, 470, 509, 525, 528, 531, 557, 560, 563, 584, 597, 613, 665, 686
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.

References

  • R. E. Maeder, Programming in Mathematica, 3rd Edition, Addison-Wesley, pages 251-252.

Crossrefs

Equal to A006878 + 1. Cf. A006884, A006885, A033492.

Extensions

Corrected and extended by Lee Corbin (lcorbin(AT)tsoft.com)
More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
Showing 1-10 of 24 results. Next