Catalan numbers: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: some explanations)
Line 1,940: Line 1,940:


=={{header|Perl 6}}==
=={{header|Perl 6}}==

We'll use the formula

<math>C_n = \frac{2(2n - 1)}{n+1}C_{n-1}</math>

and we'll observe that the sequences <math>2(2n-1)|_{n=1\rightarrow\infty}</math>
and <math>n-1|_{n=1\rightarrow\infty}</math> are respectively 2, 6, 10...etc and 2, 3...etc.

<lang perl6>constant Catalan = 1, [\*] (2, 6 ... *) Z/ 2 .. *;
<lang perl6>constant Catalan = 1, [\*] (2, 6 ... *) Z/ 2 .. *;