OFFSET
1,3
COMMENTS
Equals the total number of steps to reach 1 under the modified '3x+1' map: T(n) = n/2 if n is even, (3n+1)/2 if n is odd (see A014682).
Pairs of consecutive integers of the same height occur infinitely often and in infinitely many different patterns (Garner 1985). - Joe Slater, May 24 2018
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, E16.
J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
David Eisenbud and Brady Haran, UNCRACKABLE? The Collatz Conjecture, Numberphile Video, 2016.
Lynn E. Garner, On Heights in the Collatz 3n+1 Problem, Discrete Math. 55 (1985) 57-64.
J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, m92 (1985), 3-23.
Jeffrey C. Lagarias, The 3x+1 Problem: An Overview, arXiv:2111.02635 [math.NT], 2021.
K. Matthews, The Collatz Conjecture
Eric Weisstein's World of Mathematics, Collatz Problem
FORMULA
a(2^n) = n. - Bob Selcoe, Apr 16 2015
a(n) = ceiling(log(n*3^A006667(n))/log(2)). - Joe Slater, Aug 30 2017
a(2^k-1) = a(2^(k+1)-1)-1, for odd k>1. - Joe Slater, May 17 2018
EXAMPLE
2 -> 1 so a(2) = 1; 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1, with 5 halving steps, so a(3) = 5; 4 -> 2 -> 1 has two halving steps, so a(4) = 2; etc.
MAPLE
MATHEMATICA
Table[Count[NestWhileList[If[OddQ[#], 3#+1, #/2]&, n, #>1&], _?(EvenQ[#]&)], {n, 80}] (* Harvey P. Dale, Sep 30 2011 *)
PROG
(Haskell)
a006666 = length . filter even . takeWhile (> 1) . (iterate a006370)
-- Reinhard Zumkeller, Oct 08 2011
(Python)
def a(n):
if n==1: return 0
x=0
while True:
if not n%2:
n//=2
x+=1
else: n = 3*n + 1
if n<2: break
return x
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 14 2017
(PARI) a(n)=my(t); while(n>1, if(n%2, n=3*n+1, n>>=1; t++)); t \\ Charles R Greathouse IV, Jun 21 2017
CROSSREFS
KEYWORD
AUTHOR
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
Name edited by M. F. Hasler, May 07 2018
STATUS
approved