Skip to content

Instantly share code, notes, and snippets.

@esehara
Created July 3, 2012 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esehara/3042541 to your computer and use it in GitHub Desktop.
Save esehara/3042541 to your computer and use it in GitHub Desktop.
Project Eular 32 by Haskell
import Data.List
make_list :: [Int]
make_list = [x * y | x <- [1..5000],y <- [1..5000], ((sort ((show x) ++ (show y) ++ (show (x * y)))) == "123456789")]
duple_filter :: [Int] -> [Int] -> [Int]
duple_filter x y
| y == [] = x
| otherwise = duple_filter ((head y) : x) (filter (/= (head y)) y)
main = putStrLn $ show $ sum $ duple_filter [0] $ make_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment