catalan: Returns the Catalan numbers up to n.

Description Usage Arguments Value References Examples

Description

The Catalan numbers are a sequence of natural numbers, typically denoted C_n where n is the n^{th} Catalan number. The solution to Euler's Polygon Division Problem, which is the problem of finding the number of triangles that can be divided from a polygon of n segments, where the number of triangles is E_n, is the Catalan number C_{n-2}. The first few Catalan numbers are 1, 1, 2, 5, 14, 42, 132, 429, ... The function is implemented using the recurrence relation of C_n:

C_{n+1} = \frac{2(2n + 1)}{n + 2} C_n

Usage

1

Arguments

n

Specify the length of the returned Catalan number sequence.

Value

vector of n length

References

Catalan number. (2018, January 18). In Wikipedia, The Free Encyclopedia. Retrieved 14:03, January 27, 2018, from https://en.wikipedia.org/w/index.php?title=Catalan_number&oldid=821121794 Weisstein, Eric W. "Euler's Polygon Division Problem." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/EulersPolygonDivisionProblem.html Stanley, Richard and Weisstein, Eric W. "Catalan Number." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/CatalanNumber.html

Examples

1

aschleg/numberr documentation built on May 14, 2019, 10:31 a.m.