# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a006877
Showing 1-1 of 1
%I A006877 M0748 #116 Feb 07 2025 09:44:29
%S A006877 1,2,3,6,7,9,18,25,27,54,73,97,129,171,231,313,327,649,703,871,1161,
%T A006877 2223,2463,2919,3711,6171,10971,13255,17647,23529,26623,34239,35655,
%U A006877 52527,77031,106239,142587,156159,216367,230631,410011,511935,626331,837799
%N A006877 In the '3x+1' problem, these values for the starting value set new records for number of steps to reach 1.
%C A006877 Both the 3x+1 steps and the halving steps are counted.
%C A006877 This sequence without a(2) = 2 specifies where records occur in A208981. - _Omar E. Pol_, Apr 14 2022
%D A006877 D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
%D A006877 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A006877 Hugo Pfoertner, Table of n, a(n) for n = 1..148 (from Eric Rosendaal's 3x+1 Delay Records, terms 1..130 from T. D. Noe)
%H A006877 T. Ahmed and H. Snevily, Are there an infinite number of Collatz integers?, 2013.
%H A006877 David Barina, Convergence verification of the Collatz problem, The Journal of Supercomputing 77(3) (2021), 2681-2688.
%H A006877 David Barina, Computational Verification of the Collatz Problem, preprint on Research Square (2024).
%H A006877 Gaston H. Gonnet, Computations on the 3n+1 conjecture, Maple Technical Newsletter 6 (1991): 18-22.
%H A006877 Brian Hayes, Computer Recreations: On the ups and downs of hailstone numbers, Scientific American, 250 (No. 1, 1984), pp. 10-16.
%H A006877 J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, 92 (1985), 3-23.
%H A006877 G. T. Leavens and M. Vermeulen, 3x+1 search programs, Computers and Mathematics with Applications, 24 (1992), 79-99. (Annotated scanned copy)
%H A006877 Robert Munafo, Integer Sequences Related to 3x+1 Collatz Iteration
%H A006877 Eric Roosendaal, 3x+1 Delay Records
%H A006877 Olivier Rozier and Claude Terracol, Paradoxical behavior in Collatz sequences, arXiv:2502.00948 [math.GM], 2025. See p. 15.
%H A006877 Robert G. Wilson v, Letter to N. J. A. Sloane with attachments, Jan. 1989
%H A006877 Robert G. Wilson v, Tables of A6877, A6884, A6885, Jan. 1989
%H A006877 Index entries for sequences from "Goedel, Escher, Bach"
%H A006877 Index entries for sequences related to 3x+1 (or Collatz) problem
%p A006877 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;
%t A006877 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 *)
%t A006877 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 *)
%o A006877 (PARI) A006577(n)=my(s);while(n>1,n=if(n%2,3*n+1,n/2);s++);s
%o A006877 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]
%o A006877 r=0;print1(n=1);for(i=1,100,[n,r]=step(n,r); print1(", "n)) \\ _Charles R Greathouse IV_, Apr 01 2013
%o A006877 (Python)
%o A006877 c1 = lambda x: (3*x+1 if (x%2) else x>>1)
%o A006877 r = -1
%o A006877 for n in range(1, 10**5):
%o A006877 a=0 ; n1=n
%o A006877 while n>1: n=c1(n); a+=1;
%o A006877 if a > r: print(n1, end = ', '); r=a
%o A006877 print('...') # _Ya-Ping Lu_ and _Robert Munafo_, Mar 22 2024
%Y A006877 Cf. A006884, A006885, A006877, A006878, A033492, A380138.
%K A006877 nonn,nice
%O A006877 1,2
%A A006877 _N. J. A. Sloane_ and _Robert Munafo_
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE