Project Euler Problem 074
import Data.List import Data.Char facl :: [Integer] facl = 1:scanl1 (*) [1..9] -- 0! == 1 fac :: Int -> Integer fac = (facl!!) cha :: Integer -> [Integer] cha nn = imp nn [] where imp n acc | n`elem` acc = acc imp n acc = imp r (n:acc) where r = sum $ map (fac.digitToInt) $ show n ans :: Int ans = length $ filter ((==60).length.cha) [1..1000000] --10万で10秒ぐらいなのでコンパイルして試す --402 main :: IO () main = print ans