Hailstone

The Hailstone sequence, also known as the Collatz sequence, is a mathematical sequence defined as follows:

Start with any positive integer value.

If the number is even, divide it by 2.

If the number is odd, multiply it by 3 and add 1.

Repeat this process with the new resulting number.

The sequence will eventually reach the value of 1, no matter what starting value is chosen. This property has been proven but not yet explained.

For example, let's start with the number 6:

6 → 3 → 10 → 5 → 16 → 8 → 4 → 2 → 1

The Hailstone sequence for 6 contains 9 numbers.