Catalan numbers/Pascal's triangle: Difference between revisions
Content added Content deleted
Line 661: | Line 661: | ||
=={{header|Oforth}}== |
=={{header|Oforth}}== |
||
<lang Oforth> |
<lang Oforth>: pascal(n) [ 1 ] #[ dup 0 + 0 rot + zipWith(#+) ] times(n) ; |
||
: catalan(n) pascal(n 2 * ) at(n 1+) n 1+ / ;</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
>15 seq map(#catalan) |
>15 seq map(#catalan) . |
||
[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845] |
[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845] |
||
</pre> |
</pre> |