Question: Please Help with this problem using C++ Here is the link about Collatz sequence: http://mathworld.wolfram.com/CollatzProblem.html Project 3: Collatz Sequences [COL Set Up: A Collatz sequence

Please Help with this problem using C++

Please Help with this problem using C++ Here is the link about

Here is the link about Collatz sequence: http://mathworld.wolfram.com/CollatzProblem.html

Project 3: Collatz Sequences [COL Set Up: A Collatz sequence is defined recursively as follows an-n-1 if an- is even AND an-3an-11 if an-1 is odd and all terms of the sequence must be positive integers. For example, if the first term is set to be ai-13, then the recursive formula gives the corresponding Collatz sequence: 13-40-2010-516-8-4-21 Note, it is thought that all Collatz sequences end with 1 (called the Collatz Conjecture) Directions: Implement a Collatz sequence given any initial term ai, and find its length. Input: ai (a positive integer) Output: length of the sequence (a positive integer) and the Collatz sequence itself Extra Credit: Find the length of the longest Collatz sequence when 1 ai S 1,000, 000

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 Databases Questions!