Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List
- listToNum :: [Int] -> Int
- listToNum = foldl (\x y -> x * 10 + y) 0
- valid :: [Int] -> Bool
- valid xs = (a * b) == c
- where
- a = listToNum (take 3 xs)
- b = xs !! 3
- c = listToNum (drop 4 xs)
- main = print $ filter valid (permutations [1..8])
Add Comment
Please, Sign In to add comment