10 lines
181 B
Text
10 lines
181 B
Text
|
|
pragma.enable("accumulator")
|
||
|
|
def isPerfectNumber(x :int) {
|
||
|
|
var sum := 0
|
||
|
|
for d ? (x % d <=> 0) in 1..!x {
|
||
|
|
sum += d
|
||
|
|
if (sum > x) { return false }
|
||
|
|
}
|
||
|
|
return sum <=> x
|
||
|
|
}
|