~/algor $ cat problems/while-kollats-ketma-ketligi
Collatz sequence
Medium
1000 ms
64 MB
51%
A positive integer $n$ is given. While $n \ne 1$, the following operation is performed:
$$n \to \begin{cases} \frac{n}{2}, & n \text{ even}, \\ 3 * n + 1, & n \text{ odd}. \end{cases}$$
Find after how many operations $n = 1$, and the largest number met during the process (the initial $n$ also counts).
Input
One positive integer $n$.
Output
One line with two integers separated by a space: the number of operations and the largest number.
Note
$1 \le n \le 10^{6}$
Examples
Input #1
6
Output #1
8 16
Input #2
1
Output #2
0 1