catalan | R Documentation |
Generate Catalan numbers.
catalan(n)
n |
integer, asking for the n-th Catalan number. |
Catalan numbers, commonly denoted as C_n, are defined as
C_n = \frac{1}{n+1} {2 n \choose n}
and occur regularly in all kinds of enumeration problems.
A single integer, as long as n<=30
.
C <- numeric(10) for (i in 1:10) C[i] <- catalan(i) C[5] #=> 42
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.