Skip to content

Instantly share code, notes, and snippets.

@cmoore
Created June 18, 2009 03:46
Show Gist options
  • Save cmoore/131687 to your computer and use it in GitHub Desktop.
Save cmoore/131687 to your computer and use it in GitHub Desktop.
-- Check the actual problem for this 1000 digit number.
p8 :: String
p8 = "73167176531330624..."
p8_five [] = []
p8_five x = take 5 x : p8_five ( tail x )
-- Take a string, break it into seperate integers, and then get a product of those integers.
prod_char x = product $ map digitToInt x
problem_eight :: Int
problem_eight = maximum $ map prod_char $ p8_five p8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment