Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
project euler 9, haskell
--http://www.haskell.org/haskellwiki/Euler_problems/1_to_10 --A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, --a2 + b2 = c2 --For example, 32 + 42 = 9 + 16 = 25 = 52. --There exists exactly one Pythagorean triplet for which a + b + c = 1000. --Find the product abc. triplets l = [[a,b,c] | m <- [2..limit], n <- [1..(m-1)], let a = m^2 - n^2, let b = 2*m*n, let c = m^2 + n^2, a+b+c==l] where limit = floor . sqrt . fromIntegral $ l problem_9 = product . head . triplets $ 1000 main = print $ problem_9
run
|
edit
|
history
|
help
0
Haskell remove item by index
NQueens
Forkitup
Factorial in haskell
New wall
folder
=)
haskell linked list
Lambda Parser with long ids
Calculate Integral of function