Question

Write a function that checks whether the given number is a perfect number?

Login to Submit

Examples

Input: 6
Output: true
Reason: The factors of 6 are 1, 2, 3. If we add them 1 + 2 + 3, the result is 6 the number itself.

Input: 10
Output: false
Reason: The factors of 10 are 1, 2, 5. If we add them 1 + 2 + 5, the result is 8 which is not 10 i.e the number itself.