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

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

A288493 First differences of A006878 (record new trajectory lengths of Collatz function) (Hailstone sequence).

Original entry on oeis.org

1, 6, 1, 8, 3, 1, 3, 88, 1, 3, 3, 3, 3, 3, 3, 13, 1, 26, 8, 3, 1, 26, 8, 21, 24, 6, 8, 3, 3, 26, 3, 13, 16, 11, 3, 21, 8, 3, 57, 6, 21, 39, 16, 3, 3, 26, 3, 3, 21, 13, 16, 52, 21, 3, 3, 13, 1, 39, 205, 1, 3, 3, 8, 1, 21, 1, 13, 8, 42, 37, 44, 1, 21, 31, 26, 3, 6, 1, 8, 6, 8, 13, 52, 1, 13, 3, 8, 3, 13, 8, 52, 3, 26, 3, 3, 106, 1, 13, 3, 3, 16, 3, 13, 16, 21, 13, 8
Offset: 1

Views

Author

David Rabahy, Jun 13 2017

Keywords

Comments

The sequence appears to return to 1 again and again forever when the minimal possible new record of just (previous record + 1) is reached at the latest possible value of 2X. Through 129 there are only 2 entries, a(17) and a(21), that are a minimal new record but aren't 2X.

Examples

			For n = 3 the difference between A006878(4) = 8 and A006878(3) = 7 is 1.
		

Crossrefs

Programs

  • Mathematica
    (* This script is not suitable to compute a large number of terms. *)
    terms = 40; steps[x0_] := steps[x0] = Block[{x = x0, nos = 0}, While[x != 1, If[Mod[x, 2] == 0, x = x/2, x = 3*x + 1]; nos++]; nos]; b[1] = 1; b[n_] := b[n] = Block[{x = b[n - 1] + 1}, record = steps[x - 1]; While[steps[x] <= record, x++]; x];
    A006877 = Table[Print[b[n]]; b[n], {n, 1, terms+1}];
    A006878 = steps /@ A006877;
    Differences[A006878] (* Jean-François Alcover, Jun 15 2017 *)

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

A006884 In the '3x+1' problem, these values for the starting value set new records for highest point of trajectory before reaching 1.

Original entry on oeis.org

1, 2, 3, 7, 15, 27, 255, 447, 639, 703, 1819, 4255, 4591, 9663, 20895, 26623, 31911, 60975, 77671, 113383, 138367, 159487, 270271, 665215, 704511, 1042431, 1212415, 1441407, 1875711, 1988859, 2643183, 2684647, 3041127, 3873535, 4637979, 5656191
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.
Where records occur in A025586: A006885(n) = A025586(a(n)) and A025586(m) < A006885(n) for m < a(n). - Reinhard Zumkeller, May 11 2013

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.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A060409 gives associated "dropping times", A060410 the maximal values and A060411 the steps at which the maxima occur.

Programs

  • Haskell
    a006884 n = a006884_list !! (n-1)
    a006884_list = f 1 0 a025586_list where
       f i r (x:xs) = if x > r then i : f (i + 1) x xs else f (i + 1) r xs
    -- Reinhard Zumkeller, May 11 2013
    
  • Mathematica
    mcoll[n_]:=Max@@NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; t={1,max=2}; Do[If[(y=mcoll[n])>max,max=y; AppendTo[t,n]],{n,3,705000,4}]; t (* Jayanta Basu, May 28 2013 *)
    DeleteDuplicates[Parallelize[Table[{n,Max[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]]},{n,57*10^5}]],GreaterEqual[#1[[2]],#2[[2]]]&][[;;,1]] (* Harvey P. Dale, Apr 23 2023 *)
  • PARI
    A025586(n)=my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n)); n>>=1); r
    r=0; for(n=1,1e6, t=A025586(n); if(t>r, r=t; print1(n", "))) \\ Charles R Greathouse IV, May 25 2016

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

A033958 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, 3, 7, 9, 25, 27, 73, 97, 129, 171, 231, 313, 327, 703, 871, 1161, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 23529, 26623, 34239, 35655, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935, 626331, 837799, 1117065, 1501353, 1723519, 2298025, 3064033
Offset: 1

Views

Author

Keywords

Comments

Only the 3x+1 steps, not 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.

Crossrefs

Programs

  • Haskell
    a033958 n = a033958_list !! (n-1)
    -- For definition of a033958_list: see A033959.
    -- Reinhard Zumkeller, Jan 08 2014
  • Mathematica
    f[ nn_ ] := Module[ {c, n}, c = 0; n = nn; While[ n != 1, If[ Mod[ n, 2 ] == 0, n /= 2, n = 3*n + 1; c++ ] ]; Return[ c ] ] maxx = -1; For[ n = 1, n <= 10^8, n++, Module[ {val}, val = f[ n ]; If[ val > maxx, maxx = val; Print[ n, " ", val ] ] ] ] (* Winston C. Yang (winston(AT)cs.wisc.edu), Aug 27 2000 *)

Formula

Positions of records in A006667. - Sean A. Irvine, Jul 22 2020

Extensions

More terms from Jud McCranie, Jan 26 2000
Corrected with Mathematica code by Winston C. Yang (winston(AT)cs.wisc.edu), Aug 27 2000
a(40)-a(43) from Charles R Greathouse IV, Oct 07 2013

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

Original entry on oeis.org

0, 2, 5, 6, 7, 41, 42, 43, 44, 45, 46, 47, 52, 62, 65, 66, 76, 79, 87, 96, 98, 101, 102, 103, 113, 114, 119, 125, 129, 130, 138, 141, 142, 164, 166, 174, 189, 195, 196, 197, 207, 208, 209, 217, 222, 228, 248, 256, 257, 258, 263, 278, 357, 358, 359, 362, 370
Offset: 1

Views

Author

Keywords

Comments

Only the 3x+1 steps, not 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.

Crossrefs

Programs

  • Haskell
    a033959 n = a033959_list !! (n-1)
    (a033959_list, a033958_list) = unzip $ (0, 1) : f 1 1 where
       f i x | y > x     = (y, 2 * i - 1) : f (i + 1) y
             | otherwise = f (i + 1) x
             where y = a075680 i
    -- Reinhard Zumkeller, Jan 08 2014
  • Maple
    A033959 := 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; L := L+1; fi; od: RETURN(L); end;
  • Mathematica
    f[ nn_ ] := Module[ {c, n}, c = 0; n = nn; While[ n != 1, If[ Mod[ n, 2 ] == 0, n /= 2, n = 3*n + 1; c++ ] ]; Return[ c ] ] maxx = -1; For[ n = 1, n <= 10^8, n++, Module[ {val}, val = f[ n ]; If[ val > maxx, maxx = val; Print[ n, " ", val ] ] ] ]

Extensions

More terms from Winston C. Yang (winston(AT)cs.wisc.edu), Aug 27 2000
More terms from Larry Reeves (larryr(AT)acm.org), Sep 27 2000
Offset corrected by Reinhard Zumkeller, Jan 08 2014

A171938 Record values in A138753 (a "prime" variation of the Collatz (3n+1) problem).

Original entry on oeis.org

1, 4, 5, 8, 21, 22, 24, 29, 60, 61, 72, 73, 97, 100, 184, 216, 239, 451, 469
Offset: 1

Views

Author

M. F. Hasler, Apr 01 2008

Keywords

Crossrefs

Cf. A124123, A138750-A138754, A138756, A006878 (analog for Collatz problem).

Programs

Formula

A171938 = { A138753(m) | A138753(k) < A138753(m) for all k

Extensions

Originally submitted as A138755, but mislaid by Editor-in-Chief; renumbered and added to OEIS, Oct 24 2010
a(15)-a(19) from Paolo Xausa, Jul 29 2023

A125195 Records in A127885.

Original entry on oeis.org

0, 1, 7, 8, 16, 17, 20, 23, 31, 32, 38, 46, 47, 50, 53, 56, 59
Offset: 1

Author

David Applegate and N. J. A. Sloane, Feb 06 2007

Keywords

Crossrefs

A380138 a(n) is the largest value in the '3x+1' trajectory of starting points producing a record number of steps.

Original entry on oeis.org

1, 2, 16, 16, 52, 52, 52, 88, 9232, 9232, 9232, 9232, 9232, 9232, 9232, 9232, 9232, 9232, 250504, 190996, 190996, 250504, 250504, 250504, 481624, 975400, 975400, 497176, 11003416, 11003416, 106358020, 18976192, 41163712, 106358020, 21933016, 104674192, 593279152
Offset: 1

Author

Hugo Pfoertner, Jan 13 2025

Keywords

Crossrefs

Programs

  • Mathematica
    s = Map[ToExpression,
      StringSplit[
        Import["https://oeis.org/A006877/b006877.txt", "Data"][[2 ;; -1]]
      ][[All, -1]] ];
    Map[Max@ NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, #, # > 1 &] &, s] (* Michael De Vlieger, Jan 13 2025 *)

Formula

a(n) = A025586(A006877(n)).
Showing 1-10 of 10 results.