OFFSET
1,3
LINKS
EXAMPLE
a(15) = 9 because the Collatz trajectory starting at 15 is (15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1), which has 9 values, namely, 40, 20, 10, 5, 16, 8, 4, 2, and 1, in common with the trajectory for at least one k < 15.
MAPLE
lst1:={1}: L:={1}:for n from 2 to 200 do: x := n :lst:={n}:while x > 1 do if type(x, 'even') then x := x/2:lst:=lst union {x}: else x := 3*x+1 : lst:=lst union {x}: end if; end do; lst2:=L intersect lst:n2:=nops(lst2 ): printf(`%d, `, n2): L:=L union lst:od:
MATHEMATICA
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; found = {}; Table[c = Collatz[n]; r = Intersection[c, found]; found = Union[found, c]; Length[r], {n, 100}] (* T. D. Noe, Feb 23 2013 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Michel Lagneau, Feb 23 2013
STATUS
approved