Last active
August 29, 2015 14:08
-
-
Save domgreen/0d623d83f92bff58b4ee to your computer and use it in GitHub Desktop.
Problem8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digs :: Integral x => x -> [x] | |
digs 0 = [] | |
digs x = x `mod` 10 : digs (x `div` 10) | |
problem8 :: (Integral a) => a -> a | |
problem8 a = problem8' (digs a) | |
problem8' :: (Integral a) => [a] -> a | |
problem8' xs | |
| inputLength < 13 = 0 | |
| otherwise = max (product input) (problem8' (tail xs)) | |
where input = take 13 xs | |
inputLength = length input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment