Greek mathematicians took a special interest in numbers that are equal to the sum of their proper divisors, which is simply any divisor less than the number itself. They called such numbers perfect...


Greek mathematicians took a special interest in numbers that are equal to the sum of their proper divisors, which is simply any divisor less than the number itself. They called such numbers perfect numbers. For example, 6 is a perfect number because it is the sum of 1, 2, and 3, which are the integers less than 6 that divide evenly into 6. Similarly, 28 is a perfect number because it is the sum of 1, 2, 4, 7, and 14.


 Write a predicate function is Perfect that takes an integer n and returns true if n is perfect, and false otherwise. Test your implementation by writing a main program that uses the is Perfect function to check for perfect numbers in the range 1 to 9999 by testing each number in turn. When a perfect number is found, your program should display it on the screen. The first two lines of output should be 6 and 28. Your program should find two other perfect numbers in the range as well.



Nov 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here