Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question is runned in Wolfram Mathematica Software Question 2 - Collatz Conjecture Quit Consider the following process to generate a sequence m?, m2, m3,....

This question is runned in Wolfram Mathematica Software

image text in transcribed

Question 2 - Collatz Conjecture Quit Consider the following process to generate a sequence m?, m2, m3,.... Start with any positive integer m If m1 is even, divide it by 2, obtaining m2 -mm/2 If m1 is odd, multiply by 3 and add one, obtaining m2 3m1+1. - Repeat (with m2 in place of m? etc.) For example, starting with mi 10 we obtain the sequence 10, 5, 16, 8,4,2,1,4,2,1,.... Notice that starting with mi -1, the process produces the sequence 1, 4, 2, 1,4, 2, etc. It is a famous (and unproven) conjecture, called the Collatz conjecture (or 3n+1 conjecture), that regardless of m, the process will eventually produce the number 1 (and hence enter the cycle i,4,2, ). we will write a function to investigate this phenomenon. 1. Write, using Module, a function Collatz[m] that takes as input a positive integer m and outputs the number of times that the procedure must be repeated until we obtain 1. For example, starting with m = 10 we must repeat 6 times before obtaining 1. Ifm is not a positive integer, the function should print the message "Positive integers only!". 2. Using your function, verify that Collatz[10000]-29, Collatz[27]-111, and that Collatz[-2] and Collatz[Pi] generate the error message. Then compute Collatz[999] and Collatz[2222 3. Find the integer n in the range [1, 750] such that Collatz[n] is maximized. Report both n and Collatz[n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Decisions Based On Data Analytics For Business Excellence

Authors: Bastian Weber

1st Edition

9358681683, 978-9358681680

More Books

Students also viewed these Databases questions