2 catalan - Catalan number
13 If n >= 0, this returns the Catalan number for index n:
15 catalan(n) = comb(2*n,n)/(n + 1)
17 Zero is returned for negative n.
19 The Catalan numbers occur in solutions of several elementary
20 combinatorial problems, e.g. for n >= 1, catalan(n) is the number of
21 ways of using parentheses to express a product of n + 1 letters in
22 terms of binary products; it is the number of ways of dissecting a
23 convex polygon with n + 2 sides into triangles by nonintersecting
24 diagonals; it is the number of integer-component-incrementing paths
25 from (x,y) = (0,0) to (x,y) = (n,n) for which always y <= x.
28 > print catalan(2), catalan(3), catalan(4), catalan(20)
35 NUMBER *qcatalan(NUMBER *n)