The inverse Collatz Conjecture I think the Collatz Conjecture is already well-known. But what if we invert the rules?

Start with an integer n >= 1.

Repeat the following steps:

If n is even, multiply it by 3 and add 1.

If n is odd, subtract 1 and divide it by 2.

Stop when it reaches 0

Print the iterated numbers.

Test cases:

 1        =&gt; 1, 0
 2        =&gt; 2, 7, 3, 1, 0
 3        =&gt; 3, 1, 0
10        =&gt; 10, 31, 15, 7, 3...
14        =&gt; 14, 43, 21, 10, ...


Rules:


This sequence does not work for a lot of numbers because it enters in an infinite loop. You do not need to handle those cases. Only printing the test cases above is enough.
I suggested to subtract 1 and divide by two to give a valid integer to continue, but it is not required to be computed that way. You may divide by 2 and cast to integer or whatever other methods that will give the expected output.
You need to print the initial input as well.
The output does not need to be formatted as the test cases. It was just a suggestion. However, the iterated order must be respected.
The smallest code wins.
Perl 6, 30 bytes



{$_,{$_%2??$_+&gt;1!!$_*3+1}...0}


Try it online!

Anonymous code block that returns a sequence.

Explanation:

{$_,{$_%2??$_+&gt;1!!$_*3+1}...0}
{                            }   # Anonymous code block
   ,                     ...     # Define a sequence
 $_                              # That starts with the given value
    {                   }        # With each element being
     $_%2??     !!               # Is the previous element odd?
           $_+&gt;1                 # Return the previous element bitshifted right by 1
                  $_*3+1         # Else the previous element multiplied by 3 plus 1
                            0    # Until the element is 0