Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

□/□ * □/□ = □□/□

-- □/□ * □/□ = □□/□
r0 = [[a,b,c,d,e,f,g]|a<-[1..9],b<-[2..9],c<-[(a+1)..9],d<-[2..9],e<-[1..9],f<-[1..9],g<-[2..9],(a/b)*(c/d)==(10*e+f)/g,a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g]
r1 = [[a,b,c,d,e,f,g]|a<-[1..9],b<-[1..9],c<-[(a+1)..9],d<-[1..9],e<-[1..9],f<-[1..9],g<-[2..9],(a/b)*(c/d)==(10*e+f)/g,a/=b,a/=c,a/=d,a/=e,a/=f,a/=g,b/=c,b/=d,b/=e,b/=f,b/=g,c/=d,c/=e,c/=f,c/=g,d/=e,d/=f,d/=g,e/=f,e/=g,f/=g]
f x = map floor x
ans0 = map f r0
ans1 = map f r1
f0 = do 
    putStrLn "One is NOT permitted as denominator"
    putStrLn $ show(length(ans0)) ++ " combinations"
    print ans0

f1 = do
    putStrLn "permissive of 1 as denominator"
    putStrLn $ show(length(ans1)) ++ " combinations"
    print ans1


main = do
    f0
    f1

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.