Question: Find and display the first Collatz sequence that is longer than 100 and the first that is longer than 200. You need to create a
Find and display the first Collatz sequence that is longer than 100 and the first that is longer than 200. You need to create a fruitful function 'collatz(n)' that returns the sequence starting at n as a list. Then you need to main driver that repeatedly calls collatz() and determines the length of the returned list. Your program should
only print the results for the two requested sequences - one just larger than 100 in length and one just larger than 200 in length.
For your submission print the sequences for lengths of 1 - 8. Then print the sequences for the two long sequences that your code discovers: the first one of length = 100 and the first one of length = 200.
Step by Step Solution
There are 3 Steps involved in it
def collatzn Return the Collatz sequence starting at n as a list seq ... View full answer
Get step-by-step solutions from verified subject matter experts
