#P5727. 【深基5.例3】冰雹猜想

【深基5.例3】冰雹猜想

Problem Description

Given a positive integer nn, keep doing the following operation on this number: if the number is odd, multiply it by 33 and then add 11; otherwise, divide it by 22. After several cycles, it will always return to 11. It has been verified that even very large numbers (7×10117\times 10^{11}) can become 11 in this way, so it is called the "Collatz Conjecture". For example, when nn is 2020, the process is 2010516842120\to 10\to 5\to 16\to 8\to 4\to 2\to 1.

Given the number, verify this conjecture, and starting from the final 11, output the entire sequence in reverse order.

Input Format

Input one positive integer nn.

Output Format

Output several positive integers separated by spaces, representing the sequence in reverse order starting from the final 11.

20
1 2 4 8 16 5 10 20

Hint

Constraints: it is guaranteed that 1n1001 \le n\le 100.

Translated by ChatGPT 5