One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
import Data.Numbers.Primes | |
import Data.List | |
factors :: Integral n => n -> [n] | |
factors n = case find (\p -> n `mod` p == 0) candidates of | |
Just p -> p : (factors $ n `div` p) | |
Nothing -> [n] | |
where candidates = takeWhile (<= ceiling (sqrt (fromIntegral n))) primes | |