euler/Problem26.hs

7 lines
253 B
Haskell

-- Find the value of d < 1000 for which 1/d contains the longest recurring
-- cycle in its decimal fraction part.
import Euler
main = print $ fst $ maximumBy (compare `on` length . repeatingDigits . snd) $
map (id &&& toDecimal . (1%)) [2..999]