c[n_?OddQ]  := 3n + 1     (* for n odd *)
c[n_?EvenQ] := n/2        (* for n even   *)

CollatzLength[1]  =  1
CollatzLength[n_] := 1 + CollatzLength[c[n]]

CollatzSequence[1]  =  {1}
CollatzSequence[n_] := Prepend[ CollatzSequence[c[n]], n ]
