Question: Using MATLAB- 4. The 3n+1 sequence is a famous unsolved problem in number theory. Start with any positive integer n. Repeat the following steps: .
4. The 3n+1 sequence is a famous unsolved problem in number theory. Start with any positive integer n. Repeat the following steps: . If n-1, stop . If n is even, replace it with n/2 . If n is odd, replace it with 3n+1. For example, starting with n 7 produces 7.22,11,34,17,52.26,13,40,20,10,5,16,8,4,2,1. The unanswered question is, does the process always terminate? (Of course, I don't expect you to answer this question.) For this exercise, write the program that will ind the maximum value of L(n) for n in the range 1 s n s 1000, and determines for what value of n does it occur
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
