login
A232503
Largest power of 2 in the Collatz (3x+1) trajectory of n.
5
1, 2, 16, 4, 16, 16, 16, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 64, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 16, 16, 16, 16, 16, 16, 16, 16, 16, 64, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 64, 16, 16, 16, 16
OFFSET
1,2
COMMENTS
All terms are powers of 4 (A000302) unless n is an odd-indexed power of 2 (A004171), as explained in one of the comments for A135282. - Alonso del Arte, Nov 26 2013
FORMULA
a(n) = 2^A135282(n). - Antti Karttunen, Aug 18 2017
EXAMPLE
a(8) = 8 because then there are only halving steps and thus 8 is the largest power of 2 in its Collatz trajectory.
a(9) = 16 because the Collatz sequence for 9 goes 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 (see A033479) and the largest power of 2 there is 16.
MATHEMATICA
Collatz[n_?OddQ] := 3n + 1; Collatz[n_?EvenQ] := n/2; Table[NestWhile[Collatz, n, Not[IntegerQ[Log[2, #]]] &], {n, 64}] (* Alonso del Arte, Nov 26 2013 based on T. D. Noe's program for A135282 *)
Table[With[{p2=2^Range[0, 10]}, Select[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&], MemberQ[ p2, #]&]]//Max, {n, 70}] (* Harvey P. Dale, May 07 2016 *)
PROG
(Scheme)
(define (A232503 n) (let loop ((n n) (m 1)) (if (= 1 n) m (loop (A006370 n) (if (= 1 (A209229 n)) (max n m) m)))))
(define (A006370 n) (if (even? n) (/ n 2) (+ 1 n n n)))
;; Antti Karttunen, Aug 18 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Lance Luttrell, Nov 24 2013
STATUS
approved