
29 Oct
2007
29 Oct
'07
7:48 a.m.
Don Stewart wrote:
perfect :: [Int] perfect = [i | i<-[1..10000], i == sum (divisors i)]
This should be a little faster , as sum will fuse,
perfect :: [Int] perfect = [i | i<-[1..10000], i == sum' (divisors i)] where sum' = foldr (+) 0
sum' did not help. Times are about the same with Int type. Peter.