8 lines
444 B
Haskell
8 lines
444 B
Haskell
-- Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
|
|
-- If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.
|
|
-- Evaluate the sum of all the amicable numbers under 10000.
|
|
import Euler
|
|
|
|
amicable = [ a | a <- [1..10000], let b = sum (properDivisors a), a /= b, sum (properDivisors b) == a ]
|
|
main = print $ sum $ amicable
|