Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I don't know if the number I input is wrong, how can I output the correct highly composite number behind my wrong number. Can someone
I don't know if the number I input is wrong, how can I output the correct highly composite number behind my wrong number. Can someone help me and post the idea or program?
Assignment Overview This assignment will exercise your ability to utilize control statements (while, for, if) for C++ Background We are going to look at highly composite numbers https://en wikipedia.org/wiki/Highly_composite number. A highly composite number is calculated in the following way. For the positive integer n . We calculate the count of divisors, numbers that divide evenly into n without remainder. We also calculate the count of divisors for every number from 1 to n-l We say that n is highly composite if it has a count of divisors greater than the count of divisors of any of the integers 1 to n-l The Wikipedia page gives a list of highly composite numbers of different orders. The order of the numbers lists the next element in the sequence of integers that increases its count of divisors. The column d(n) gives the count of divisors. For example, 12 is a highly composite number. Its divisors are: ,2, 3, 4, 6, 12. It has the order 5 (5th in the series from 1 that increase its divisor count. No number 1-11 has the same or more divisors than 12. Another example, 20 is not highly composite. It has as its divisors 1, 2, 4, 5, 10, 20. The first number from 1 to 20 that has 6 divisors is the number 12, as we just saw Project Description/ Specification Input Input is a single, positive integer that is 1 or greater Output for each test case will be If the input is 0 or less, then the word "Error" is printed and processing ends If no error, then you must determine if the input is highly composite Ifit is highly composite, print"True", a space, the input number, a space, and the count of divisors. For 12, the output would be True 12 6 on a single line Ifit is not highly composite, print "False", a space, the input number, a space, the first number in the sequence 1 to input that has the same number of divisors, a space, and the count of the smaller number's divisors. For 20, the output would be False 20 12 6 on a single line. 20 has 6 divisors (1, 2, 4, 5, 10, 20) but 12 was the first number in the sequence 1 to 20 with 6 divisors. o o Requirements . As mentioned, any input number from the test case is not an integer1 prints "Error". Though the requirements also mention that it should be an integer, we are not yet capable of testing for thatStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started