dsa · easy

Perfect Number

A **perfect number** equals the sum of its positive divisors excluding itself. 6 is perfect because 1 + 2 + 3 = 6. 1 is not (it has no proper divisor other than the empty sum 0).

Arguments

Return whether num is perfect.

Example

num = 28. Divisors excluding itself: 1, 2, 4, 7, 14. Sum 28true.

num = 7 is prime, so the only proper divisor is 1false.

Constraints

1 <= num <= 10^8

Examples

Example 1

Input:
28

Expected:
true

Example 2

Input:
7

Expected:
false

Open in the Dojo editor