Created
April 9, 2015 15:16
-
-
Save nicolasbrugneaux/42981db898272ab7957d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- problem 31 | |
primes :: [Int] | |
primes = nextPrime [2..] | |
where nextPrime (p:xs) = p:nextPrime [x | x <- xs, x `mod` p > 0] | |
-- problem 35 | |
primeFactors :: Int -> [Int] | |
primeFactors n = [ x | x <- (takeWhile (< n) primes), n `mod` x == 0 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment