OFFSET
1,1
COMMENTS
The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd. The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
REFERENCES
J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.
EXAMPLE
trajectory: 39, 118, 59, 178, 89, 268, 134, 67, 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 has 12 odd numbers.
MATHEMATICA
odd12Q[n_]:=Count[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&], _?OddQ]==12; Select[Range[1300], odd12Q] (* Harvey P. Dale, Oct 17 2011 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jim Nastos, Jun 19 2002
STATUS
approved