#b448. Weird Algorithm (test problem)
Weird Algorithm (test problem)
Description
Author: miyun
Consider an algorithm that takes as input a positive integer . If is even, the algorithm divides it by two, and if is odd, the algorithm multiplies it by three and adds one. The algorithm repeats this, until is one. For example, the sequence for is as follows:
$$3→10→5→16→8→4→2→1 3 → 10 → 5 → 16 → 8 → 4 → 2 → 13→10→5→16→8→4→2→1$$Your task is to simulate the execution of the algorithm for a given value of .
Constraints
# Below are test area.
test bold
test italic</p>
test underline
strikethrough
super
sub
code
-
list1
-
list2
Input Format
The only input line contains an integer .
Output Format
Print a line that contains all values of during the algorithm.
3
3 10 5 16 8 4 2 1