%I M0748 #106 Aug 06 2024 09:55:43
%S 1,2,3,6,7,9,18,25,27,54,73,97,129,171,231,313,327,649,703,871,1161,
%T 2223,2463,2919,3711,6171,10971,13255,17647,23529,26623,34239,35655,
%U 52527,77031,106239,142587,156159,216367,230631,410011,511935,626331,837799
%N In the '3x+1' problem, these values for the starting value set new records for number of steps to reach 1.
%C Both the 3x+1 steps and the halving steps are counted.
%C This sequence without a(2) = 2 specifies where records occur in A208981. - _Omar E. Pol_, Apr 14 2022
%D D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Hugo Pfoertner, <a href="/A006877/b006877.txt">Table of n, a(n) for n = 1..148</a> (from Eric Rosendaal's 3x+1 Delay Records, terms 1..130 from T. D. Noe)
%H T. Ahmed and H. Snevily, <a href="https://citeseerx.ist.psu.edu/pdf/2207919fcc0e2e4336faf345389c5dcd2daea50e">Are there an infinite number of Collatz integers?</a>, 2013.
%H Gaston H. Gonnet, <a href="https://www.researchgate.net/publication/322519890_Maple_Technical_Newsletter_-_Second_issue_-_No6">Computations on the 3n+1 conjecture</a>, Maple Technical Newsletter 6 (1991): 18-22.
%H Brian Hayes, <a href="https://www.jstor.org/stable/24969271">Computer Recreations: On the ups and downs of hailstone numbers</a>, Scientific American, 250 (No. 1, 1984), pp. 10-16.
%H J. C. Lagarias, <a href="http://www.cecm.sfu.ca/organics/papers/lagarias/paper/html/paper.html">The 3x+1 problem and its generalizations</a>, Amer. Math. Monthly, 92 (1985), 3-23.
%H G. T. Leavens and M. Vermeulen, <a href="/A006877/a006877_1.pdf">3x+1 search programs</a>, Computers and Mathematics with Applications, 24 (1992), 79-99. (Annotated scanned copy)
%H R. Munafo, <a href="http://www.mrob.com/pub/seq/wondrous.html">Integer Sequences Related to 3x+1 Collatz Iteration</a>
%H Eric Roosendaal, <a href="http://www.ericr.nl/wondrous/delrecs.html">3x+1 Delay Records</a>
%H Robert G. Wilson v, <a href="/A006877/a006877.pdf">Letter to N. J. A. Sloane with attachments, Jan. 1989</a>
%H Robert G. Wilson v, <a href="/A006884/a006884.pdf">Tables of A6877, A6884, A6885, Jan. 1989</a>
%H <a href="/index/Go#GEB">Index entries for sequences from "Goedel, Escher, Bach"</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%H David Barina, <a href="https://doi.org/10.1007/s11227-020-03368-x">Convergence verification of the Collatz problem</a>, The Journal of Supercomputing 77(3) (2021), 2681-2688.
%H David Barina, <a href="https://doi.org/10.21203/rs.3.rs-3845558/v1">Computational Verification of the Collatz Problem</a>, preprint on Research Square (2024).
%p 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 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 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 (PARI) A006577(n)=my(s);while(n>1,n=if(n%2,3*n+1,n/2);s++);s
%o 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 r=0;print1(n=1);for(i=1,100,[n,r]=step(n,r); print1(", "n)) \\ _Charles R Greathouse IV_, Apr 01 2013
%o (Python)
%o c1 = lambda x: (3*x+1 if (x%2) else x>>1)
%o r = -1
%o for n in range(1, 10**5):
%o a=0 ; n1=n
%o while n>1: n=c1(n); a+=1;
%o if a > r: print(n1, end = ', '); r=a
%o print('...') # _Ya-Ping Lu_ and _Robert Munafo_, Mar 22 2024
%Y Cf. A006884, A006885, A006877, A006878, A033492.
%K nonn,nice
%O 1,2
%A _N. J. A. Sloane_, _Robert Munafo_