A221956 Number of values in the Collatz (3x+1) trajectory starting at n that are also present in the trajectory for some k < n.
0, 1, 2, 3, 6, 8, 7, 4, 17, 7, 15, 9, 10, 18, 9, 5, 13, 20, 16, 8, 5, 16, 16, 10, 21, 11, 17, 19, 19, 18, 107, 6, 24, 14, 14, 21, 19, 22, 23, 9, 110, 8, 22, 17, 14, 17, 105, 11, 25, 25, 20, 12, 12, 112, 106, 20, 30, 20, 33, 19, 20, 108, 95, 7, 28, 27, 28, 15, 12
Offset: 1
Examples
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.
Links
Programs
-
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 *)