CS100 Lab4 QuestionsV2(1) [Compatibility Mode] Word (Unlicensed Product) gs Review View Help O Tell me what you want to do OFind AaBbCcDd AaBbCcDd ab ac Replace T Normal T List Para... * Select - Paragraph Styles Editing In 1937, a German mathematician named Lothar Collatz formulated an intriguing hypothesis (it still remains unproven) which can be described in the following way: 1. take any non-negative and non-zero integer number and name it c%; 2. if it's even, evaluate a new c0 as c0 ÷ 23; 3. otherwise, if it's odd, evaluate a new c0 as 3 x c0 + 1; 4. if c0 1, skip to point 2. The hypothesis says that regardless of the inițial value of co, it will always go to 1. Of course, it's an extremely complex task to use a computer in order to prove the hypothesis for any natural number (it may even need artificial intelligence), but you can use Python to check some individual numbers. Maybe you'll even find the one which would disprove the hypothesis. Write a program which reads one natural number and executes the above steps as long as co remains different from 1(cO != 1). Moreover, we'll add another task - we want you to count the steps needed to achieve the goal. Your code should output all the intermediate values of co, too. Hint: the most important part of the problem is how to transform Collatz's idea into a while loop - this is the key to success. Test your code using the data we've provided Example input 15 Example output 46 23 70 35 106 53 160 80 40 20 10 5 16 84 2 1 steps = 17 Example input 16 Example output 9A21 ctonc- KI>I> ']

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The question is in the image.

CS100 Lab4 QuestionsV2(1) [Compatibility Mode]
Word (Unlicensed Product)
gs
Review
View
Help
O Tell me what you want to do
OFind
AaBbCcDd AaBbCcDd
ab
ac Replace
T Normal
T List Para...
* Select -
Paragraph
Styles
Editing
In 1937, a German mathematician named Lothar Collatz formulated an intriguing
hypothesis (it still remains unproven) which can be described in the following way:
1. take any non-negative and non-zero integer number and name it c%;
2. if it's even, evaluate a new c0 as c0 ÷ 23;
3. otherwise, if it's odd, evaluate a new c0 as 3 x c0 + 1;
4. if c0 1, skip to point 2.
The hypothesis says that regardless of the inițial value of co, it will always go to 1.
Of course, it's an extremely complex task to use a computer in order to prove the
hypothesis for any natural number (it may even need artificial intelligence), but you
can use Python to check some individual numbers. Maybe you'll even find the one
which would disprove the hypothesis.
Write a program which reads one natural number and executes the above steps as
long as co remains different from 1(cO != 1). Moreover, we'll add another task - we
want you to count the steps needed to achieve the goal. Your code should output all
the intermediate values of co, too.
Hint: the most important part of the problem is how to transform Collatz's idea into
a while loop - this is the key to success.
Test your code using the data we've provided
Example input
15
Example output
46 23 70 35 106 53 160 80 40 20 10 5 16 84 2 1 steps = 17
Example input
16
Example output
9A21 ctonc-
KI>I>
']
Transcribed Image Text:CS100 Lab4 QuestionsV2(1) [Compatibility Mode] Word (Unlicensed Product) gs Review View Help O Tell me what you want to do OFind AaBbCcDd AaBbCcDd ab ac Replace T Normal T List Para... * Select - Paragraph Styles Editing In 1937, a German mathematician named Lothar Collatz formulated an intriguing hypothesis (it still remains unproven) which can be described in the following way: 1. take any non-negative and non-zero integer number and name it c%; 2. if it's even, evaluate a new c0 as c0 ÷ 23; 3. otherwise, if it's odd, evaluate a new c0 as 3 x c0 + 1; 4. if c0 1, skip to point 2. The hypothesis says that regardless of the inițial value of co, it will always go to 1. Of course, it's an extremely complex task to use a computer in order to prove the hypothesis for any natural number (it may even need artificial intelligence), but you can use Python to check some individual numbers. Maybe you'll even find the one which would disprove the hypothesis. Write a program which reads one natural number and executes the above steps as long as co remains different from 1(cO != 1). Moreover, we'll add another task - we want you to count the steps needed to achieve the goal. Your code should output all the intermediate values of co, too. Hint: the most important part of the problem is how to transform Collatz's idea into a while loop - this is the key to success. Test your code using the data we've provided Example input 15 Example output 46 23 70 35 106 53 160 80 40 20 10 5 16 84 2 1 steps = 17 Example input 16 Example output 9A21 ctonc- KI>I> ']
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Concept of Light
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education