A positive integer is perfect when it equals the sum of its proper divisors (all positive divisors except the number itself). For instance 6 = 1 + 2 + 3. Write is_perfect(n) that returns True if n is perfect and False otherwise. 1 is not perfect: it has no proper divisors, so their sum is 0.
Examples
Input: n = 28
Output: True
Explanation: 1 + 2 + 4 + 7 + 14 = 28
Input: n = 12
Output: False
Explanation: 1 + 2 + 3 + 4 + 6 = 16
Constraints
1 <= n <= 10**5
Goals
- Find divisors of a number with a loop and %
- Sum a filtered set of values and compare with the original