1.3 Zeeshan's Number Odyssey
Zeeshan was a man with a penchant for patterns. His mind, a complex labyrinth of numbers and equations, found solace in the orderly dance of mathematical constructs. One evening, as he delved deeper into the realm of number theory, a peculiar sequence caught his attention. It began with a random positive integer. If the number was even, it was halved. If odd, it was tripled and incremented by one. This new number then underwent the same transformation, and so on.
To Zeeshan's astonishment, regardless of the starting number, the sequence always converged to the solitary digit, one. This intriguing phenomenon sparked a curiosity within him. He wondered about the length of these number trails, the highest peaks and valleys they reached before their inevitable descent to unity.
Driven by intellectual fervor, Zeeshan embarked on a computational journey. He aimed to create a digital explorer, a program that could traverse these number landscapes for any given starting point. This digital companion would meticulously record the steps, the highs and lows, of each number's odyssey to one. Zeeshan named this endeavor the 'Number Odyssey
Constraints
Input Format
The only input line contains an integer n. — Starting of the Sequence.
Output Format
Print a line that contains all values of n during the algorithm.
Example 1
Input:
3
Output:
10 5 16 8 4 2 1
Explanation:
Self Explanatory
Example 2
Input:
7
Output:
22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
Explanation:
Self Explanatory
Log In to solve the Question