OFFSET
1,3
COMMENTS
a(n) = 0 if n is a power of 2, as a(1) = a(2) = a(4) = ... = 0; however a(20) = a(24) = ... = 0 also and as such the condition (n = 2^k, k>=0) is sufficient but not necessary for a(n) = 0.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A087225(n) - 1.
EXAMPLE
a(3) = 3 because the Collatz trajectory for 3 is [3, 10, 5, 16, 8, 4, 2, 1], reaching the largest term, 16, in three steps.
a(4) = 0 because the Collatz trajectory only goes down from 4.
a(20) = 0: 20 is the largest term in [20, 10, 5, 16, 8, 4, 2, 1].
MATHEMATICA
Collatz[n_] :=NestWhileList[If[EvenQ[#], #/2, 3*# + 1] &, n, # > 1 &]; Table[Position[Collatz[n], Max[Collatz[n]]] - 1, {n, 82}](* Jayanta Basu, Mar 24 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jayanta Basu, Feb 19 2013
EXTENSIONS
More terms from Alois P. Heinz, Feb 20 2013
STATUS
approved