import Data.List
sameDigit m n =(sort.show) m == (sort.show) n
p052 n = all (sameDigit n) .map (n*)$ [2..6]
main = print.find p052 $[1..]