Starting with a number, the following is called the Collatz rule:

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

If the number is even, divide by 2.

The Collatz conjecture suggests that when you keep doing this, you will always reach 1 eventually.

For example, if you start with 7, you reach \(1\) in 16 steps:
\[ 7 \to 22 \to 11 \to 34 \to 17 \to 52 \to 26 \to 13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1. \]
However, 7 is not the only number that requires 16 steps. What is the total number of positive integers which require exactly 16 steps to reach 1 *for the first time*?

**Note**: This problem is intended to have a coding solution.

×

Problem Loading...

Note Loading...

Set Loading...