Project Euler Problem 040
import Data.Char list :: [Char] list = concatMap show [1..] dn :: Int -> Char dn n = list !! (n-1) ans1 :: Int ans1 =product $ map (digitToInt. dn) [1,10,100,1000,10000,100000,1000000] ans2 :: Int ans2=product $ map (digitToInt.((concatMap show [1..])!!).(flip (-) 1)) [10^i|i<-[1..6]] ans3 :: Int ans3=product $ map (digitToInt.((concatMap show [1..])!!).(subtract 1)) [10^i|i<-[1..6]] ans4 :: Int ans4=foldr(*)1$ map(\x->digitToInt$ concat[show x|x<-[0..]]!!(10^x))[0..6] ans5 :: Int ans5=product $ map (digitToInt.((concatMap show [0..])!!)) [10^i|i<-[1..6]] ans6 :: Int ans6=product $ map (digitToInt.((concatMap show [0..])!!).(10^)) [1..6] -- 210 main :: IO () main = print ans1