Question: Write programs to do each of the following. The programs should be labeled a through c: For all programs, you should Include comments in your

Write programs to do each of the following. The programs should be labeled a through c: For all programs, you should Include comments in your code that describe the purpose of individual blocks. a) The Collatz conjecture: The Collatz conjecture, also known as the 3n+1 conjecture (and other names), deals with the following operation to produce a sequence of numbers. Given a number, n, if n is even then the next number is n divided by 2. If n is odd, then the next number is 3n+1. The Collatz conjecture is that this sequence of numbers always eventually reaches 1. As simple as this seems, it is unproven (and considered extremely hard to prove) by mathematicians. As an example of a sequence, if you start with the number 6, then the terms of the sequence will be: 6, 3, 10, 5, 16, 8, 4, 2,1 Write a program that takes in a positive integer from a user, and computes the Collatz sequence, printing out all the numbers in the sequence, followed by a line stating how many iterations it took to reach the value 1 b) Averaging measurements Assume that someone has collected a set of measurements and wants some statistical data about them. Write a program that asks a user for measurements and prints the average, the maximum, and the minimum measurement. Users should be allowed to enter as many measurements as they want, until entering a negative measurement. The negative measurement should not be processed, but is just used to indicate that the user has finished entering measurements. [Note: do not use a list to store the measurements.] c) Divisors: For numbers from 2 to 100, print a series of lines indicating which numbers are divisors of other numbers. For each, print out "X divides Y", where X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
