Slightly modified for a parity sequence, as I understand it - because when n is odd, 3n + 1 is always even.
The Hailstone parity sequence for every number then eventually enters the cycle 0 - 1 - 0.
The basic function is just 'HOPTO' - Half Or Triple Plus One, with the Hailstone sequence eventually reaching 4 - 2 - 1.
_________________
Giraffe: a ruminant with a view.