Guest User

Untitled

a guest
Jul 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. factors' :: Integral t => t -> [t]
  2. factors' n
  3. | n < 0 = factors' (-n)
  4. | n > 0 = if 1 == n
  5. then []
  6. else let fac = mfac n 2 in fac : factors' (n `div` fac)
  7. where mfac m x
  8. | rem m x == 0 = x
  9. | x * x > m = m
  10. | otherwise = mfac m (if odd x then x + 2 else x + 1)
Add Comment
Please, Sign In to add comment