Catalan numbers/Pascal's triangle: Difference between revisions
Content added Content deleted
(→{{header|Racket}}: removed erroneous NOWIKI html tags.) |
(→{{header|REXX}}: used better factoring (as per user Pike) for calculating Catalan numbers.) |
||
Line 485: | Line 485: | ||
do j=1 for N /* [↓] show N Catalan numbers*/ |
do j=1 for N /* [↓] show N Catalan numbers*/ |
||
say comb(j+j,j) |
say comb(j+j,j) % (j+1) /*display the Jth Catalan number.*/ |
||
end /*j*/ |
end /*j*/ |
||
exit /*stick a fork in it, we're done.*/ |
exit /*stick a fork in it, we're done.*/ |
||
Line 501: | Line 501: | ||
numeric digits max(9,N*4) /*can handle huge Catalan numbers*/ |
numeric digits max(9,N*4) /*can handle huge Catalan numbers*/ |
||
!.=. |
!.=. |
||
do j=1 for N |
do j=1 for N /* [↓] show N Catalan numbers*/ |
||
say comb(j+j,j) |
say comb(j+j,j) % (j+1) /*display the Jth Catalan number.*/ |
||
end /*j*/ |
end /*j*/ |
||
exit /*stick a fork in it, we're done.*/ |
exit /*stick a fork in it, we're done.*/ |