Question: please slove this matlab question Problem #4.1 The Collatz Conjecture (https://en.wikipedia.org/wiki/Collatz_conjecture)concerns the following sequence: for any positive integer, if it is even, divide it by
please slove this matlab question
Problem \#4.1 The Collatz Conjecture (https://en.wikipedia.org/wiki/Collatz_conjecture)concerns the following sequence: for any positive integer, if it is even, divide it by two and if it is odd, multiply it by three and add 1 . Then, take the result and perform this operation again. f(n)={2n3n+1ifn0(mod2)ifn1(mod2) The conjecture states that every positive integer will eventually end up at one (where it gets caught in a 4,2,1 loop forever). The stopping time is defined as how long it takes to get to one. For example, take the number 5. Following the rules above we get 5, 16, 8, 4, 2, 1. So the stopping time of 5 would be 6. Write a script that computes the stopping time for every integer from 1 to 1000 . Plot the stopping time against the integer input. Your plot should look something like this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
