Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. primzahlen = sieb [2..]
  2. where sieb (p:xs) = p : sieb [n | n <- xs, n `mod` p > 0]
  3.  
  4. fact n (p:ys) | p*p > n = [n]
  5. | n `mod` p == 0 = p : fact (n `div` p) (p:ys)
  6. | otherwise = fact n ys
  7. primfaktor 1 = []
  8. primfaktor n = fact n primzahlen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement