#K40117. Steps to Reduce to One

    ID: 26572 Type: Default 1000ms 256MiB

Steps to Reduce to One

Steps to Reduce to One

Given a positive integer \( x \), perform the following operation repeatedly until \( x \) becomes 1:

\( \text{if } x \text{ is even, then } x = \frac{x}{2} \); otherwise, \( x = 3x + 1 \).

Return the number of steps required to achieve \( x = 1 \). This problem is based on the famous Collatz Conjecture.

inputFormat

The input begins with a single integer \( T \) (\( T \geq 1 \)), which indicates the number of test cases. Each of the following \( T \) lines contains one positive integer \( x \).

outputFormat

For each test case, output a single integer that represents the number of steps required to reduce \( x \) to 1. Each answer should be printed on a new line.

## sample
5
3
6
19
50
100
7

8 20 24 25

</p>