login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual appeal: Please make a donation to keep the OEIS running! Over 6000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A006666 Number of halving steps to reach 1 in `3x+1' problem.
(Formerly M3733)
33
0, 1, 5, 2, 4, 6, 11, 3, 13, 5, 10, 7, 7, 12, 12, 4, 9, 14, 14, 6, 6, 11, 11, 8, 16, 8, 70, 13, 13, 13, 67, 5, 18, 10, 10, 15, 15, 15, 23, 7, 69, 7, 20, 12, 12, 12, 66, 9, 17, 17, 17, 9, 9, 71, 71, 14, 22, 14, 22, 14, 14, 68, 68, 6, 19, 19, 19, 11, 11, 11, 65, 16, 73, 16, 11, 16 (list; graph; refs; listen; history; text; internal format)
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, n -> (3n+1)/2 if n is odd (see A014682).

A092892(a(n)) = n and A092892(m) <> n for m < a(n). - Reinhard Zumkeller, Mar 14 2014

a(2^n) = n. - Bob Selcoe, Apr 16 2015

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

J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, 92 (1985), 3-23.

K. Matthews, The Collatz Conjecture

Eric Weisstein's World of Mathematics, Collatz Problem

Index entries for sequences related to 3x+1 (or Collatz) problem

FORMULA

a(n) = ceiling(log(n*3^A006667(n))/log(2)). - Joe Slater, Aug 30 2017

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

# A014682

T:=proc(n) if n mod 2 = 0 then n/2 else (3*n+1)/2; fi; end;

# A006666

t1:=[0]:

for n from 2 to 100 do

L:=1; p := n;

while T(p) <> 1 do p:=T(p); L:=L+1; od:

t1:=[op(t1), L];

od: t1;

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 n%2==0:

            n/=2

            x+=1

        else: n = 3*n + 1

        if n<2: break

    return x

print [a(n) for n in xrange(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

Cf. A014682. A006577, A006370.

Sequence in context: A202494 A112597 A257700 * A267830 A163334 A029683

Adjacent sequences:  A006663 A006664 A006665 * A006667 A006668 A006669

KEYWORD

nonn,nice,look,easy

AUTHOR

N. J. A. Sloane, Bill Gosper

EXTENSIONS

More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy .

Last modified November 18 05:04 EST 2017. Contains 294852 sequences.