OFFSET
1,4
COMMENTS
Assuming Collatz trajectory ends with 1 and also a(1)=0.
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4)=2 because the number closest to 4 in Collatz trajectory of 4 is 2.
MATHEMATICA
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Join[{0}, Table[Min[Rest[Abs[Collatz[n] - n]]], {n, 2, 100}]]
CROSSREFS
KEYWORD
nonn
AUTHOR
Jayanta Basu, Mar 03 2013
STATUS
approved