RosettaCodeData/Task/Perfect-numbers/Scala/perfect-numbers-1.scala
2023-07-01 13:44:08 -04: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