Write a function perfect that determines whether a number is a perfect number or not. This function should receive a number and return true if the number is perfect and false otherwise. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the divisors of each perfect number to confirm that the number is indeed perfect as shown in the sample output below.

An integer is said to be a perfect number if the sum of its divisors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3.

Sample output

Perfect integers between 1 and 1000:

6 = 1 + 2 + 3

28 = 1 + 2 + 4 + 7 + 14

496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248

An integer is said to be a perfect number if the sum of its divisors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3.

Sample output

Perfect integers between 1 and 1000:

6 = 1 + 2 + 3

28 = 1 + 2 + 4 + 7 + 14

496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248

### Recently Asked Questions

- Currently, Boeing pays an annual dividend of $2.92. If the stock is selling for $128, what is the dividend yield?

- A sample of 4 lizards had their tail lengths measured in cm . The results are illustrated in the following stemplot : The decimal point is at the | 7 | 45 8 |

- Refer to the figure below . Refer to the figure above . The shift of the frontier from A to B was most likely caused by which of the following ?