Correct Problem3.hs to use the new type for `primes`.
This commit is contained in:
parent
f5c67f891c
commit
f8d2bb4a48
|
|
@ -1,7 +1,7 @@
|
||||||
-- What is the largest prime factor of the number 600851475143 ?
|
-- What is the largest prime factor of the number 600851475143 ?
|
||||||
import Euler
|
import Euler
|
||||||
|
|
||||||
factors n = go (primes ()) n
|
factors n = go primes n
|
||||||
where go (p:ps) n | n < p = []
|
where go (p:ps) n | n < p = []
|
||||||
| n `mod` p == 0 = p : go (p:ps) (n `div` p)
|
| n `mod` p == 0 = p : go (p:ps) (n `div` p)
|
||||||
| otherwise = go ps n
|
| otherwise = go ps n
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue