Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
project euler 7, haskell
--http://www.haskell.org/haskellwiki/Euler_problems/1_to_10 --By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. --What is the 10 001st prime number? primes = 2 : filter ((==1) . length . primeFactors) [3,5..] primeFactors n = factor n primes where factor n (p:ps) | p*p > n = [n] | n `mod` p == 0 = p : factor (n `div` p) (p:ps) | otherwise = factor n ps problem_7 = primes !! 10000 main = print $ problem_7
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Anonymous recursion. Why doesnt compile?
Métodos simples
Perfect numbers
State
Reader
Search
haskell_exam
Reader
Removed input
mySqrt
Please log in to post a comment.