Background The Collatz conjecture (also known as the "3n+1 conjecture") is a conjecture in mathematics that concerns sequences defined by the following algorithm. Start with any positive integer n. Then each term, called a hailstone, is obtained from the previous term as follows: If the previous term is even, the next term is one half of the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what positive integer value you start with for n, the sequence will always reach 1. Assignment Description Write a program that prompts a user to enter a positive integer to begin the algorithm for the Collatz conjecture. The program will use a while loop to print each term (hailstone) and make repeated decisions to determine which transformation to apply to each value of the sequence according to the conjecture algorithm until it reaches 1. Accept This Assignment B Purpose This assignment has the following purposes: . Practice analyzing a problem • Practice implementing a solution in Python • Practice using iteration structures to create repeated decision structures to control program execution flow Sample Output Enter a positive integer value: 17 The hailstones are: 52
Background The Collatz conjecture (also known as the "3n+1 conjecture") is a conjecture in mathematics that concerns sequences defined by the following algorithm. Start with any positive integer n. Then each term, called a hailstone, is obtained from the previous term as follows: If the previous term is even, the next term is one half of the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what positive integer value you start with for n, the sequence will always reach 1. Assignment Description Write a program that prompts a user to enter a positive integer to begin the algorithm for the Collatz conjecture. The program will use a while loop to print each term (hailstone) and make repeated decisions to determine which transformation to apply to each value of the sequence according to the conjecture algorithm until it reaches 1. Accept This Assignment B Purpose This assignment has the following purposes: . Practice analyzing a problem • Practice implementing a solution in Python • Practice using iteration structures to create repeated decision structures to control program execution flow Sample Output Enter a positive integer value: 17 The hailstones are: 52
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
Related questions
Question
I use pycharm/phyton when I create the solutions. I started on the solution but can not seem to get any futher with completing the solution.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education