Question: python 3 beginner Question 2 3n+ 1 algorithm generates a sequence of numbers starting with an integer n. If n is even, t is divided

python 3 beginner
Question 2 3n+ 1" algorithm generates a sequence of numbers starting with an integer n. If n is even, t is divided by 2. If n is odd, it is multiplied by 3 and 1 is added. This process is repeated with each new value of n, terminating when n 1. For example: the following ing sequence of numbers will be generated for n numbers 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 22: For any given input n, the cycle-length is the number ending integer) to of integers included (including the starting and reach the value of 1. In the example above, the cycle length of 22 is 16. Write a function named q evaluate each integer using the "3n + 1" algorithm to determine which has the higher cycle-length value. Finally, the q20 function should return whichever integer has the higher cycle-length and its cycle-length value. 20 that accepts two (2) Int values as parameters. Your q20 function should Example Input / Output >q2 (317, 412) (412, 90) >>>q2 (100, 200) (200, 27) >>>q2 (2177, 3125) (2177, 139) >>>q2 (903, 1000) (903, 117)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
