Question

# Problem 2: (3 points) Define a new function named collatz that takes one positive integer as a parameter and

returns a list of numbers, starting with the initial number. Then use a while loop to add to the list using the following process: - Let n be the value currently at the end of the list. - If n is even, add to the list the number: (n // 2) - If n is odd, add to the list the number: (3*n + 1) - If the number 1 is added to the list, the function should return the entire list. 2 This problem is known as the Collatz conjecture and for any value of n, the list will eventually get to a 1 (though this hasn't been formally proven) Here are some examples of output: >>> collatz(5) [5, 16, 8, 4, 2, 1] >>> collatz(6) [6, 3, 10, 5, 16, 8, 4, 2, 1]