Perfect numbers: Difference between revisions

m
(→‎{{header|Ruby}}: added fast method (Lucas-Lehmer))
Line 1,572:
=={{header|Scala}}==
<lang scala>def perfectInt(input: Int) = ((2 to sqrt(input).toInt).collect {case x if input % x == 0 => x + input / x}).sum == input - 1</lang>
 
'''or'''
 
<lang scala>def perfect(n: Int) =
(for (x <- List.range(1, n/2 + 1) if n % x == 0) yield x).sum == n
</lang>
 
=={{header|Scheme}}==
Anonymous user