Sylvester's sequence: Difference between revisions
Content deleted Content added
Added solution for Pascal |
No edit summary |
||
Line 488: | Line 488: | ||
<syntaxhighlight lang="haskell">sylvester :: [Integer] |
<syntaxhighlight lang="haskell">sylvester :: [Integer] |
||
sylvester = iterate (succ . ((*) <*> pred)) 2</syntaxhighlight> |
sylvester = iterate (succ . ((*) <*> pred)) 2</syntaxhighlight> |
||
=={{header|J}}== |
|||
J uses r instead of / to display rationals |
|||
<syntaxhighlight lang="j"> 2 ('Sum of reciprocals: ' , ":@:(+/))@:%@:([ echo&>)@:((, 1x +(*/))@[&_~) 9 |
|||
2 |
|||
3 |
|||
7 |
|||
43 |
|||
1807 |
|||
3263443 |
|||
10650056950807 |
|||
113423713055421844361000443 |
|||
12864938683278671740537145998360961546653259485195807 |
|||
165506647324519964198468195444439180017513152706377497841851388766535868639572406808911988131737645185443 |
|||
Sum of reciprocals: 27392450308603031423410234291674686281194364367580914627947367941608692026226993634332118404582438634929548737283992369758487974306317730580753883429460344956410077034761330476016739454649828385541500213920805r27392450308603031423410234291674686281194364367580914627947367941608692026226993634332118404582438634929548737283992369758487974306317730580753883429460344956410077034761330476016739454649828385541500213920806</syntaxhighlight> |
|||
=={{header|jq}}== |
=={{header|jq}}== |