#K84977. Collatz Conjecture Sequence Length

    ID: 36539 Type: Default 1000ms 256MiB

Collatz Conjecture Sequence Length

Collatz Conjecture Sequence Length

In this problem, you are given an integer x and you need to compute the length of the Collatz sequence starting from x until it reaches 1. The Collatz sequence is defined as follows:

\(x = 1\) terminates the sequence. For \(x > 1\):

  • If \(x\) is even, the next term is \(\frac{x}{2}\).
  • If \(x\) is odd, the next term is \(3x + 1\).

You are given multiple test cases. For each test case, compute and output the length of the Collatz sequence for the given integer.

inputFormat

The first line of input contains an integer T representing the number of test cases. Each of the following T lines contains a single integer x.

outputFormat

For each test case, output the length of the Collatz sequence on a separate line.

## sample
3
5
10
3
6

7 8

</p>