hailstone[n_] = 
        If[Mod[n, 2]  ==  1,  (3*n) + 
            1, (n/2)];

hailstone[2]

hailstone[15]

hailstone[27]

27*3 + 1

<< DiscreteMath`Combinatorica`