The program takes a number (n) and processes it through the while loop. It is complete when the value of n reaches 1.the program would normally print out the value it started with and the length of the sequence of numbers it went through to reach 1.  In other words, it takes one value for n and processes it, producing a series (or sequence) of numbers. For example, using the supplied program, output using the start value of 51 would look like:             The sequence starting at 51 has length 25 What You Must Do Test all possible input values between 1 and 500,000 (including those two values). You are looking for two sequences: one with the longest sequence of numbers of any of the sequences, and one with the highest value reached of any value in any of the sequences. At end of the program, with appropriate messages, show: the starting value and the length (number of values) of the longest sequence in the series, and the starting value of the sequence with the highest value reached in the series with the high value itself. The final output will look something like this:      The longest sequence starts at 27 and has length 44      The highest value sequence starts at 53 and has the high value 100 The values shown here are for demonstration only and are not even close to the correct answers. Do not print out the intermediate values in the series. You are to print only the two lines, with the appropriate values in them, as described above.

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 program takes a number (n) and processes it through the while loop. It is complete when the value of n reaches 1.the program would normally print out the value it started with and the length of the sequence of numbers it went through to reach 1.  In other words, it takes one value for n and processes it, producing a series (or sequence) of numbers.

For example, using the supplied program, output using the start value of 51 would look like:

            The sequence starting at 51 has length 25

What You Must Do

Test all possible input values between 1 and 500,000 (including those two values).

You are looking for two sequences:

  • one with the longest sequence of numbers of any of the sequences, and
  • one with the highest value reached of any value in any of the sequences.
  • At end of the program, with appropriate messages, show:
    • the starting value and the length (number of values) of the longest sequence in the series, and
    • the starting value of the sequence with the highest value reached in the series with the high value itself.

The final output will look something like this:

     The longest sequence starts at 27 and has length 44

     The highest value sequence starts at 53 and has the high value 100

The values shown here are for demonstration only and are not even close to the correct answers.

Do not print out the intermediate values in the series. You are to print only the two lines, with the appropriate values in them, as described above.

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
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