Question: MATLAB Problem 6 ( 2 0 Points ) The Collatz Conjecture is an interesting one. Consider the following operation on an arbitrary positive integer from
MATLAB
Problem Points
The Collatz Conjecture is an interesting one. Consider the following operation on an arbitrary
positive integer from to :
That is if the number is even, divide it by two; if the number is odd, triple it and add one. For
example, by applying this operation successively for a starting point we get:
cdots
It was conjectured that, starting with any positive integer, this operation eventually ends up with
the periodic sequence There is no proof yet!
a Write a userdefined function "Collatz" which has as input, and the following outputs:
A vector with all integers in the sequence.
The number of steps such that the number first appears in the sequence.
The maximum integer that the sequence reached for a given value
b For the set of integers in the interval write a code which calls the userdefined
function and produces the following and show the outputs with appropriate details and labels:
A plot for the sequence corresponding to
A plot of vs the sequence length.
A plot of vs the maximum integer in its corresponding sequence.
A plot of vs the average of consecutive differences of the sequence integers.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
