vin / challenge

Python challenge and project euler

This URL has Read+Write access

challenge / euler / euler072.hs
100644 12 lines (8 sloc) 0.266 kb
1
2
3
4
5
6
7
8
9
10
11
12
import Ratio
import Data.Set
 
diff d = 3%7 - (d * 3 `div` 7) % d
fracs = fromList [diff d | d <- [1..1000000], d > 0]
 
uniq [x] = [x]
uniq (x:y:ys) | x == y = uniq (y:ys)
              | otherwise = x:uniq(y:ys)
 
main = print $ (3%7 - findMin (delete (0%1) fracs))