13 lines
667 B
Haskell
13 lines
667 B
Haskell
-- It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.
|
|
--
|
|
-- Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
|
|
import Data.List
|
|
|
|
smallestPermutedMultiples :: Integer
|
|
smallestPermutedMultiples = head [ x | x <- [1..], sort (show x) == sort (show (2 * x)), sort (show x) == sort (show (3 * x)), sort (show x) == sort (show (4 * x)), sort (show x) == sort (show (5 * x)), sort (show x) == sort (show (6 * x)) ]
|
|
|
|
main = do
|
|
let result = smallestPermutedMultiples
|
|
putStrLn $ "Project Euler, Problem 52\n"
|
|
++ "Answer: " ++ show result
|