login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A006667 Number of tripling steps to reach 1 from n in '3x+1' problem, or -1 if 1 is never reached.
(Formerly M0019)
57
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 (list; graph; refs; listen; history; text; internal format)
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
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
A033959 and A033958 give record values and where they occur. - Reinhard Zumkeller, Jan 08 2014
a(n*2^k) = a(n), for all k >= 0. - L. Edson Jeffery, Aug 11 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) = floor(log(2^A006666(n)/n)/log(3)). - Joe Slater, Aug 30 2017
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.
Sequence in context: A292577 A055509 A334226 * A112570 A127755 A180662
KEYWORD
nonn,nice,hear
AUTHOR
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 28 04:16 EST 2024. Contains 370379 sequences. (Running on oeis4.)