Pell numbers: Difference between revisions
Content added Content deleted
Line 431: | Line 431: | ||
, ("a002315", a002315) |
, ("a002315", a002315) |
||
] |
] |
||
putStrLn "\nRational approximations to sqrt 2:" |
putStrLn "\nRational approximations to sqrt 2:" |
||
mapM_ putStrLn $ |
mapM_ putStrLn $ |
||
Line 440: | Line 441: | ||
a001333 |
a001333 |
||
a000129 |
a000129 |
||
putStrLn "\nPythagorean triples:" |
putStrLn "\nPythagorean triples:" |
||
print $ take |
mapM_ print $ take 10 pythagoreanTriples</syntaxhighlight> |
||
{{Out}} |
{{Out}} |
||
<pre> |
<pre> |
||
a000129 |
|||
[0,1,2,5,12,29,70,169,408,985] |
[0,1,2,5,12,29,70,169,408,985] |
||
Line 468: | Line 471: | ||
Pythagorean triples: |
Pythagorean triples: |
||
(3,4,5) |
|||
[(3,4,5),(20,21,29),(119,120,169),(696,697,985),(4059,4060,5741)]</pre> |
|||
(20,21,29) |
|||
(119,120,169) |
|||
(696,697,985) |
|||
(4059,4060,5741) |
|||
(23660,23661,33461) |
|||
(137903,137904,195025) |
|||
(803760,803761,1136689) |
|||
(4684659,4684660,6625109) |
|||
(27304196,27304197,38613965)</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |