Perfect numbers: Difference between revisions
Content deleted Content added
→Functional Python (faster version): A simplification, with one less import. |
|||
Line 2,330:
Or,
<lang python>'''Perfect numbers'''
from math import sqrt
Line 2,347 ⟶ 2,346:
return 0 == (n % x)
▲ lows = list(filter(p, enumFromTo(1)(int(sqrt(n)))))
return 1 < n and (
n == sum(lows +
)
Line 2,372 ⟶ 2,365:
# GENERIC -------------------------------------------------
# enumFromTo :: (Int, Int) -> [Int]
|