Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
project euler 10, haskell
--http://www.haskell.org/haskellwiki/Euler_problems/1_to_10 --The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. --Find the sum of all the primes below one million. 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_10 = sum (takeWhile (< 1000000) primes) main = print $ problem_10
run
|
edit
|
history
|
help
0
Cubed
haskell_exam
Reader
ex3
haskell linked list
ReaderPractice
Pascal's triangle in 10 lines
haskell_exam_demo
State
ad-hoc braille dot rendering