Project Euler Problem 026
import Data.List import Data.Ord nums :: [Integer] nums = [ n | n <- [3,5..], n `mod` 5 /= 0 ] --偶数と5の倍数を省いてる period :: Integer -> Integer period n = head $ [ p | p <- [1..], (10^p - 1) `mod` n == 0 ] ans1 :: Integer ans1 = fst $ maximumBy (comparing snd) $ map(\x->(x,period x)) $ takeWhile (<1000) nums -- 983 main :: IO () main = print ans1