The product 7254 is unusual, as the identity, 39 x 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.

Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.

HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.

なんか眠い。頭が働かない。2桁×3桁=4桁でいいのかな?

import Data.List
pdct n = [z|(x,y)<-map(splitAt n)digit,let z =read x*read y,sort (x++y++show z)=="123456789"]
where digit = perm "123456789" 5
perm _  = [[]]
perm xs (n+1) = [a:b|a<-xs,b<-perm (delete a xs) n]
p032 = sum.nub $ pdct 1 ++ pdct 2

と思ったら1桁×4桁=4桁もあった罠。