Collatz conjecture, also known as 3n+1 problem, which is a conjecture in mathematics that is about a sequence defined as follows:
Let $S_1$ be a positive integer which is the start of the sequence, and
$
S_{n+1}=
\begin{align}
\begin{cases}
S_n\ /\ 2&,\text{if }S_n\text{ is even} \\
3\ S_n\ +\ 1&,\text{if }S_n\text{ is odd} \\
\end{cases}
\end{align}
$
The conjecture is that for any given positive integer $S_1\ (<10^ 5)$, the sequence will reach $1$.
the sequence will be: $22\ 11\ 34\ 17\ 52\ 26\ 13\ 40\ 20\ 10\ 5\ 16\ 8\ 4\ 2\ 1$
As students of NCKU, we are interested in this conjecture,
please write a program to help us do some research in this conjecture.
A positive integer $S_1\ (1 < S_1 < 10^ 5)$
Two integer $L\ M$ within a line, where $L$ represents the length of the sequence and $M$ is the maximum number of the sequence.
No. | Testdata Range | Score |
---|---|---|
1 | 0~11 | 100 |
No. | Time Limit (ms) | Memory Limit (KiB) | Output Limit (KiB) | Subtasks |
---|---|---|---|---|
0 | 1000 | 65536 | 65536 | |
1 | 1000 | 65536 | 65536 | |
2 | 1000 | 65536 | 65536 | |
3 | 1000 | 65536 | 65536 | |
4 | 1000 | 65536 | 65536 | |
5 | 1000 | 65536 | 65536 | |
6 | 1000 | 65536 | 65536 | |
7 | 1000 | 65536 | 65536 | |
8 | 1000 | 65536 | 65536 | |
9 | 1000 | 65536 | 65536 | |
10 | 1000 | 65536 | 65536 | |
11 | 1000 | 65536 | 65536 |