#C12955. Collatz Sequence Steps
Collatz Sequence Steps
Collatz Sequence Steps
Given a positive integer n, the Collatz sequence is defined as follows: if n is even, then the next number is \(\frac{n}{2}\); if n is odd, then the next number is \(3n+1\). This process is repeated until the number becomes 1. Your task is to determine the number of steps required for n to reach 1.
Note: It is conjectured (but not proven) that the sequence will reach 1 for all positive integers. This problem assumes that for the input values provided, the sequence terminates at 1.
inputFormat
The input consists of a single positive integer n (1 ≤ n ≤ 10^9
), which is provided via stdin.
outputFormat
Output a single integer, the number of steps required for the Collatz sequence starting from n to reach 1, printed to stdout.
## sample1
0