Jump to content

Catalan numbers/Pascal's triangle: Difference between revisions

m
Line 661:
=={{header|Oforth}}==
 
<lang Oforth>func: pascal(n) { [ 1 ] #[ dup 0 + 0 rot + zipWith(#+) ] times(n) };
func: catalan(n) { pascal(n 2 * ) at(n 1 +) n 1 + / };</lang>
 
{{out}}
<pre>
>15 seq map(#catalan) println.
[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845]
</pre>
1,015

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.