Question: Extend the function in Lab 1 code to: 1 . Find the length of a Collatz conjecture sequence For example, if I try 5 ,

Extend the function in Lab1 code to:
1. Find the length of a Collatz conjecture sequence
For example, if I try 5, I get 5 numbers in the sequence: 16,8,4,2,1
If I try 6, I get 8 numbers: 3,10,5,16,8,4,2,1
You can print a message to the console after the sequence:
For example: Length of Collatz conjecture sequence is ....

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!