login
Search: a033958 -id:a033958
     Sort: relevance | references | number | modified | created      Format: long | short | data
Record number of steps to reach 1 in '3x+1' problem, corresponding to starting values in A033958.
+20
4
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,2
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.
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 ] ] ] ]
PROG
(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
CROSSREFS
KEYWORD
nonn,nice
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
STATUS
approved
Number of tripling steps to reach 1 from n in '3x+1' problem, or -1 if 1 is never reached.
(Formerly M0019)
+10
59
0, 0, 2, 0, 1, 2, 5, 0, 6, 1, 4, 2, 2, 5, 5, 0, 3, 6, 6, 1, 1, 4, 4, 2, 7, 2, 41, 5, 5, 5, 39, 0, 8, 3, 3, 6, 6, 6, 11, 1, 40, 1, 9, 4, 4, 4, 38, 2, 7, 7, 7, 2, 2, 41, 41, 5, 10, 5, 10, 5, 5, 39, 39, 0, 8, 8, 8, 3, 3, 3, 37, 6, 42, 6, 3, 6, 6, 11, 11, 1, 6, 40, 40, 1, 1, 9, 9, 4, 9, 4, 33, 4, 4, 38
OFFSET
1,3
COMMENTS
A075680, which gives the values for odd n, isolates the essential behavior of this sequence. - T. D. Noe, Jun 01 2006
A033959 and A033958 give record values and where they occur. - Reinhard Zumkeller, Jan 08 2014
REFERENCES
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 204, Problem 22.
R. K. Guy, Unsolved Problems in Number Theory, E16.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, 92 (1985), 3-23.
Eric Weisstein's World of Mathematics, Collatz Problem.
FORMULA
a(1) = 0, a(n) = a(n/2) if n is even, a(n) = a(3n+1)+1 if n>1 is odd. The Collatz conjecture is that this defines a(n) for all n >= 1.
a(n) = A078719(n) - 1; a(A000079(n))=0; a(A062052(n))=1; a(A062053(n))=2; a(A062054(n))=3; a(A062055(n))=4; a(A062056(n))=5; a(A062057(n))=6; a(A062058(n))=7; a(A062059(n))=8; a(A062060(n))=9. - Reinhard Zumkeller, Oct 08 2011
a(n*2^k) = a(n), for all k >= 0. - L. Edson Jeffery, Aug 11 2014
a(n) = floor(log(2^A006666(n)/n)/log(3)). - Joe Slater, Aug 30 2017
a(n) = a(A085062(n)) + A007814(n+1) for n >= 2. - Alan Michael Gómez Calderón, Feb 07 2025
MAPLE
a:= proc(n) option remember; `if`(n<2, 0,
`if`(n::even, a(n/2), 1+a(3*n+1)))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Aug 08 2023
MATHEMATICA
Table[Count[Differences[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&]], _?Positive], {n, 100}] (* Harvey P. Dale, Nov 14 2011 *)
PROG
(PARI) for(n=2, 100, s=n; t=0; while(s!=1, if(s%2==0, s=s/2, s=(3*s+1)/2; t++); if(s==1, print1(t, ", "); ); ))
(Haskell)
a006667 = length . filter odd . takeWhile (> 2) . (iterate a006370)
a006667_list = map a006667 [1..]
-- Reinhard Zumkeller, Oct 08 2011
(Python)
def a(n):
if n==1: return 0
x=0
while True:
if n%2==0: n/=2
else:
n = 3*n + 1
x+=1
if n<2: break
return x
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 14 2017
CROSSREFS
Equals A078719(n)-1.
Cf. A000079, A006370, A006577, A006666 (halving steps), A092893, A127789.
KEYWORD
nonn,nice,hear,changed
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
"Escape clause" added to definition by N. J. A. Sloane, Jun 06 2017
STATUS
approved
Record number of steps to reach 1 in '3x+1' problem, corresponding to starting values in A006877.
(Formerly M4335)
+10
11
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,3
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).
LINKS
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)
Brian Hayes, Computer Recreations: On the ups and downs of hailstone numbers, Scientific American, 250 (No. 1, 1984), pp. 10-16.
J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, 92 (1985), 3-23.
G. T. Leavens and M. Vermeulen, 3x+1 search programs, Computers and Mathematics with Applications, 24 (1992), 79-99. (Annotated scanned copy)
Eric Roosendaal, 3x+1 Delay Records
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 *)
KEYWORD
nonn,nice
STATUS
approved
Leading digits in 3x+1 chain starting with the number 1117065.
+10
2
1, 3, 1, 8, 2, 1, 3, 1, 5, 2, 1, 4, 2, 6, 3, 1, 4, 2, 7, 3, 1, 5, 1, 8, 4, 1, 6, 1, 9, 2, 1, 4, 2, 6, 3, 9, 4, 1, 6, 3, 1, 5, 1, 7, 2, 1, 3, 1, 5, 2, 7, 3, 1, 5, 1, 8, 4, 1, 6, 1, 9, 2, 1, 7, 3, 1, 9, 4, 2, 6, 3, 1, 5, 2, 1, 3, 1, 5, 2, 8, 4, 1, 6, 1, 9, 2, 1, 4, 2, 6, 3, 1, 8, 2, 1, 3, 1, 5, 2, 1, 4, 2, 6, 3, 1
OFFSET
1,2
COMMENTS
The 3x+1 chain starts 1117065 -> 3351196 -> 1675598 -> 837799 and enters a 4->2->1->4->.. cycle after 527 iterations. The current sequence shows the most significant decimal digit after each iteration. [R. J. Mathar, Jul 26 2010]
LINKS
A. V. Kontorovich & S. J. Miller, Benford's Law, Values Of L-Functions And The 3x+1 Problem, arXiv:math/0412003 [math.NT], 2004-2005.
J. C. Lagarias and K. Soundararajan, Benford's Law for the 3x+1 Function, arXiv:math/0509175 [math.NT], 2005-2006.
PROG
(PARI) lista(nn) = my(c = 1117065); for (n=1, nn, print1(digits(c)[1], ", "); if (c % 2, c = 3*c+1, c = c/2); ); \\ Michel Marcus, Nov 05 2016
CROSSREFS
Cf. A033958.
KEYWORD
nonn,base
AUTHOR
Lekraj Beedassy, Dec 10 2005
EXTENSIONS
a(103) corrected by Michel Marcus, Nov 05 2016
STATUS
approved

Search completed in 0.008 seconds