haskell: add [p4, p10]

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-10-27 08:54:11 +05:30
parent e3f9ab49f3
commit ad0acc15c9
8 changed files with 81 additions and 2 deletions

6
haskell/p9.hs Normal file
View File

@@ -0,0 +1,6 @@
main :: IO ()
main = putStr $ show $ solve 1000
-- Brute search because don't care 🧌
solve :: Integer -> Integer
solve p = head [a * b * c | a <- [1 .. p], b <- [a + 1 .. p], let c = p - a - b, c > 0 && c ^ 2 == a ^ 2 + b ^ 2]