login
A224166
Number of halving and tripling steps to reach the last number of the cycle in the Collatz (3x+1) problem for the negative integers (the initial term is counted).
3
2, 2, 5, 3, 5, 6, 5, 4, 12, 5, 7, 7, 10, 5, 10, 5, 18, 13, 8, 5, 24, 8, 19, 8, 18, 11, 8, 6, 11, 11, 22, 6, 29, 18, 14, 14, 18, 9, 14, 6, 18, 25, 9, 9, 23, 20, 17, 9, 27, 18, 12, 12, 17, 9, 18, 7, 30, 12, 12, 12, 18, 23, 20, 7, 38, 30, 21, 18, 20, 15, 20, 15
OFFSET
1,1
FORMULA
a(n) = A224183(n) + 1.
EXAMPLE
a(10) = 5 because the trajectory of -10 is -10 -> -5 -> -14 -> -7 -> -20 -> -10 and -10 is the last term of the cycle, hence 5 iterations where the first term -10 is counted.
MATHEMATICA
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, UnsameQ, All]; Table[s = Collatz[-n]; len = Length[s] - 2; If[s[[-1]] == 2, len = len - 1]; len+1, {n, 1, 100}]
CROSSREFS
Sequence in context: A130327 A224361 A341443 * A286109 A239665 A178179
KEYWORD
nonn
AUTHOR
Michel Lagneau, Apr 01 2013
EXTENSIONS
a(1) changed to 2 by Pontus von Brömssen, Jan 24 2021
STATUS
approved