Question: The progamming language for this question is c++. 168421, stop. A cycle occurs if you get a number back that you have already seen. For

The progamming language for this question is c++.

The progamming language for this question is c++. 168421, stop. A cycle

168421, stop. A cycle occurs if you get a number back that you have already seen. For now, you only need to test for the number that starts the sequence. That is from above, each time you get a number, check that it is not equal to 10. Show the sequence as you find it. Keep asking the user until -1 is entered. Phase 3: The conjecture is if you repeatedly take the output of the function and use it as input, a power of 2 will show up and reduce to the 4, 2, 1 cycle. Write a program that will test all integers from 1 to 100,000 to find if they will always reduce to 1. Do not print every number, do incremental messages, i.e. all 10000 works, all 20000... Bonus: Can you improve your runtime calculating to see if all numbers past 100,000? You will need to use long long int instead of int since some numbers past 100,000 may have a number beyond 2A32, which is the maximum number that can be stored as an integer Example Input and Output: Enter integer f(x): 10 f (10)5 Enter integer f(x): 15 (15)46 Enter integer f(x): -1 Enter integer for sequence: 10 10 ->5 - 16-8->4->2- 1 10 reduces to 1 Enter integer for sequence: 17 17->5226- 13-4020105-> 16-8-4-2->1 17 reduces to 1 Enter integer for sequence: -1 All numbers from 00001-10000 work All numbers from 10001 - 20000 work I/ you shouldn't have more that 10 -20 lines of output here All numbers from 90001 - 100000 work All numbers from 1- 100000 reduce to 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!