Question: use MATLAB 5. Consider a sequence {ao, Quay, ...), where a, is some natural number and an+1 = 14./2, if a, is even, 13an +
5. Consider a sequence {ao, Quay, ...), where a, is some natural number and an+1 = 14./2, if a, is even, 13an + 1, if a, is odd. For example, if a = 3, then we have (3, 10, 5, 16, 8, 4, 2, 1.4.2.1... and if a. = 9. then (9.28. 14. 7. 22, 11. 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4. 2. 1.4.2.1...). In fact, as far as we know, the sequence eventually reaches I starting from any natural number in other words, there is no known counterexample). On the other hand, the statement that it reaches I for all natural numbers, known as the Collatz conjecture, is one of the great unsolved problems in mathematics (see, for example, "Collatz conjecture in Wikipedia) Write a function with header (period, a_max] - mycollatz (ac), where period is the length of the sequence before it reaches the first and a max is the maximum number in this sequence. For example: [period, a_max] - myCollat2(9) period - 19 a max- 52 Use your function with the input a sum (myvec)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
