RosettaCodeData/Task/Perfect-numbers/Scala/perfect-numbers-1.scala
2015-02-20 00:35:01 -05:00

1 line
125 B
Scala

def perfectInt(input: Int) = ((2 to sqrt(input).toInt).collect {case x if input % x == 0 => x + input / x}).sum == input - 1