Functions
Function-27
Function-28
Function-29
~/algor $ cat problems/funksiya-mukammal-sonlar
Is it a perfect number
Easy
2000 ms
128 MB
28%
Write a function IsPerfect(x) that returns true if the positive integer $x$ is perfect and false otherwise. A perfect number equals the sum of its positive divisors smaller than itself.
Example 1: IsPerfect(28) → true — $1 + 2 + 4 + 7 + 14 = 28$.
Example 2: IsPerfect(12) → false — $1 + 2 + 3 + 4 + 6 = 16$.
Write only the function body.
Input
One line with a positive integer $x$ — the argument of the function.
Output
The value returned by the function: true or false.
Note
$1 \le x \le 10^{4}$
Examples
Input #1
28
Output #1
true
Input #2
12
Output #2
false