#P5727. 【深基5.例3】冰雹猜想
【深基5.例3】冰雹猜想
Problem Description
Given a positive integer , keep doing the following operation on this number: if the number is odd, multiply it by and then add ; otherwise, divide it by . After several cycles, it will always return to . It has been verified that even very large numbers () can become in this way, so it is called the "Collatz Conjecture". For example, when is , the process is .
Given the number, verify this conjecture, and starting from the final , output the entire sequence in reverse order.
Input Format
Input one positive integer .
Output Format
Output several positive integers separated by spaces, representing the sequence in reverse order starting from the final .
20
1 2 4 8 16 5 10 20
Hint
Constraints: it is guaranteed that .
Translated by ChatGPT 5