Hailstone sequence
This page is the answer to the task Hailstone sequence in the Rosetta Code.
Description (from Rosetta Code)
The Hailstone sequence of numbers can be generated from a starting positive integer, n by:
The (unproven) Collatz conjecture is that the hailstone sequence for any starting number always terminates. The hailstone sequence is also known as hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as the Collatz sequence. Task

Routine
Case 1
Use the routine to show that the hailstone sequence for the number 27 has 112 elements starting with 27, 82, 41, 124
and ending with 8, 4, 2, 1
Note that the extraction of an element from a list with negative index means that it is counted from the end, it is, the is the last element, the is the penulatimate one, and so on.
Case 2
Show the number less than 100,000 which has the longest Hailstone sequence together with that sequence's length (But don't show the actual sequence!).
The longest Hailstone sequence number is 77,031, having 351 elements.