Catalan numbers/Pascal's triangle: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations.)
No edit summary
Line 1,064: Line 1,064:
if x-y<y then y=x-y; _=1; do j=x-y+1 to x; _=_*j; end; return _/!(y)</lang>
if x-y<y then y=x-y; _=1; do j=x-y+1 to x; _=_*j; end; return _/!(y)</lang>
'''output''' &nbsp; is the same as the 1<sup>st</sup> version. <br><br>
'''output''' &nbsp; is the same as the 1<sup>st</sup> version. <br><br>

=={{header|Ring}}==
<lang ring>
n=15
cat = list(n+2)
cat[1]=1
for i=1 to n
for j=i+1 to 2 step -1
cat[j]=cat[j]+cat[j-1]
next
cat[i+1]=cat[i]
for j=i+2 to 2 step -1
cat[j]=cat[j]+cat[j-1]
next
see "" + (cat[i+1]-cat[i]) + " "
next
</lang>
Output:
<pre>
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845
</pre>


=={{header|Ruby}}==
=={{header|Ruby}}==