Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- factors' :: Integral t => t -> [t]
- factors' n
- | n < 0 = factors' (-n)
- | n > 0 = if 1 == n
- then []
- else let fac = mfac n 2 in fac : factors' (n `div` fac)
- where mfac m x
- | rem m x == 0 = x
- | x * x > m = m
- | otherwise = mfac m (if odd x then x + 2 else x + 1)
Add Comment
Please, Sign In to add comment