Perfect numbers: Difference between revisions

Content deleted Content added
Hout (talk | contribs)
→‎Functional (faster version): Updated primitives, tidied.
Hout (talk | contribs)
Line 2,344: Line 2,344:
# p :: Int -> Bool
# p :: Int -> Bool
def p(x):
def p(x):
'Factor of n.'
'Factor of n ?'
return 0 == (n % x)
return 0 == (n % x)


Line 2,377: Line 2,377:
'''Concatenated list over which a function has been mapped.
'''Concatenated list over which a function has been mapped.
The list monad can be derived by using a function f which
The list monad can be derived by using a function f which
wraps its output a in list
wraps its output a in list,
(using an empty list to represent computational failure).'''
(using an empty list to represent computational failure).'''
return lambda xs: list(
return lambda xs: list(