Created
April 11, 2011 23:20
-
-
Save smcl/914591 to your computer and use it in GitHub Desktop.
I hate myself
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
--Project Euler problem 38 | |
-- What is the largest 1 to 9 pandigital 9-digit number that can be formed as | |
-- the concatenated product of an integer with (1,2, ... , n) where n > 1? | |
import Data.List | |
pandigital9 = map (\x -> read x :: Integer) $ permutations "123456789" | |
main = print $ last $ sort $ takeWhile (<987654321) $ concat $ map (\y -> filter (`elem` pandigital9) $ takeWhile (<987654321) $ map (\x -> read (concat $ map (show) $ map (y*) [1..x]) :: Integer) [1..]) [1..] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment