Pell numbers: Difference between revisions

Content added Content deleted
(→‎{{header Haskell}}: Added a Haskell draft)
Line 430: Line 430:
, ("a002315", a002315)
, ("a002315", a002315)
]
]
putStrLn "\nRational approximations to sqrt 2:"
putStrLn "\nRational approximations to sqrt 2:"
mapM_ putStrLn $ take 10 $
mapM_ putStrLn $
tail $ zipWith
(take 10 . tail) $
zipWith
(\n d -> show n <> ('/':show d) <> " -> "
(\n d ->
<> show (fromIntegral n / fromIntegral d))
a001333
show n <>
('/' : show d) <> " -> " <> show (fromIntegral n / fromIntegral d))
a000129
a001333
a000129
putStrLn "\nPythagorean triples:"
putStrLn "\nPythagorean triples:"
print $ take 5 pythagoreanTriples</syntaxhighlight>
print $ take 5 pythagoreanTriples</syntaxhighlight>