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.

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

This page as a plain text file.
%I A033959 #18 Apr 01 2022 09:13:15
%S A033959 0,2,5,6,7,41,42,43,44,45,46,47,52,62,65,66,76,79,87,96,98,101,102,
%T A033959 103,113,114,119,125,129,130,138,141,142,164,166,174,189,195,196,197,
%U A033959 207,208,209,217,222,228,248,256,257,258,263,278,357,358,359,362,370
%N A033959 Record number of steps to reach 1 in '3x+1' problem, corresponding to starting values in A033958.
%C A033959 Only the 3x+1 steps, not the halving steps, are counted.
%D A033959 D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
%D A033959 G. T. Leavens and M. Vermeulen, 3x+1 search problems, Computers and Mathematics with Applications, 24 (1992), 79-99.
%H A033959 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 A033959 <a href="/index/Go#GEB">Index entries for sequences from "Goedel, Escher, Bach"</a>
%H A033959 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%p A033959 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;
%t A033959 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 ] ] ] ]
%o A033959 (Haskell)
%o A033959 a033959 n = a033959_list !! (n-1)
%o A033959 (a033959_list, a033958_list) = unzip $ (0, 1) : f 1 1 where
%o A033959    f i x | y > x     = (y, 2 * i - 1) : f (i + 1) y
%o A033959          | otherwise = f (i + 1) x
%o A033959          where y = a075680 i
%o A033959 -- _Reinhard Zumkeller_, Jan 08 2014
%Y A033959 Cf. A006884, A006885, A006877, A006878, A033492, A033958.
%Y A033959 Cf. A075680.
%K A033959 nonn,nice
%O A033959 1,2
%A A033959 _N. J. A. Sloane_
%E A033959 More terms from Winston C. Yang (winston(AT)cs.wisc.edu), Aug 27 2000
%E A033959 More terms from Larry Reeves (larryr(AT)acm.org), Sep 27 2000
%E A033959 Offset corrected by _Reinhard Zumkeller_, Jan 08 2014