euler/Problem047.hs

11 lines
323 B
Haskell

-- Find the first four consecutive integers to have four distinct prime
-- factors. What is the first of these numbers?
import Euler
distinct = map head . group
nFactors = map (id &&& length . distinct . primeFactors) [1..]
main = print $ map fst $ head $
filter (all (==4) . map snd) $ map (take 4) $ tails nFactors