Project Euler Problem 033
import Data.Ratio import Data.List n :: [Integer] n = [1..9] --0はtrivialになるので除いた lis :: [(Integer, Integer)] lis = nub $ sort [(num,den) | a<-n,b<-n,a/=b,d<-n,d/=b, let num = 10*a+b, let den = 10*b+d, (num%den) == (a%d) ] ans1 :: Integer ans1 = denominator $ product $ map (\(l,r)->l%r) lis -- 100 main :: IO () main = print ans1