public
Created

Project Euler - Problem 5

  • Download Gist
euler-005.hs
Haskell
1 2 3 4 5 6 7 8 9 10 11 12
import Data.List(sort)
 
result = head
$ filter
(\x -> isDivisible x [12,14,15,16,18,20])
candidates
where candidates = [primeProds, primeProds * 2..]
primeProds = 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19
isDivisible n divisors = and
$ map
(\d -> n `mod` d == 0)
divisors

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.