Integer roots: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: An earlier reversion reverted)
Line 401: Line 401:
where
where
pn = pred n
pn = pred n
go (_:xs@(x:y:_))
go (x:xs@(y:z:_))
| x == y = x
| x == y || x == z = min y z
| otherwise = go xs
| otherwise = go xs

main :: IO ()
main :: IO ()
main = mapM_ (print . uncurry integerRoot) [(3, 8), (3, 9), (2, 2 * 100 ^ 2000)]</lang>
main = mapM_ (print . uncurry integerRoot) [(3, 8), (3, 9), (2, 2 * 100 ^ 2000)]</lang>