Compute the n-th Catalan number exactly, generate the sequence, and visualize its exponential growth. Catalan numbers count countless combinatorial structures: valid parentheses expressions, full binary trees, monotonic lattice paths, and polygon triangulations.
Bar chart showing the rapid growth of Catalan numbers (logarithmic scale applied for display).
The Catalan numbers Cn form a sequence of natural numbers that appear in many counting problems in combinatorics. They are named after the Belgian mathematician Eugène Charles Catalan (1814–1894). The closed-form expression is:
Equivalently, they satisfy the recurrence: C0 = 1, and Cn+1 = Σi=0n Ci·Cn-i. The first few Catalan numbers (starting n=0) are: 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, ... Their growth is asymptotically Cn ~ (4n)/(n3/2√π).
In compiler design and expression parsing, Catalan numbers give the exact count of structurally distinct binary trees with n internal nodes. For n = 5, there are C5 = 42 possible trees. This influences optimal search tree construction and syntax tree generation. Our calculator helps researchers and students instantly verify tree counts for algorithmic analysis.
The sequence was first described by Leonhard Euler (1751) when counting triangulations of convex polygons. Later, Catalan (1838) connected it to parenthesization problems. The explicit formula using binomial coefficients was derived by Eugène Catalan and is now a fundamental result in enumerative combinatorics. The OEIS entry A000108 contains more than 200 combinatorial interpretations.
This tool implements high-precision integer arithmetic using JavaScript's BigInt to compute exact Catalan numbers via multiplication and division of binomial coefficient C(2n, n)/(n+1). The sequence generation uses recurrence caching for performance, supporting accurate results up to n=45 (beyond that numbers become astronomically large, but we limit input to 0–30 for clarity). The bar chart visualizes the exponential growth, using a logarithmic normalization for better readability and comparison.
| n | Catalan Number Cn | Common interpretation count |
|---|---|---|
| 0 | 1 | 1 binary tree with 0 nodes |
| 3 | 5 | 5 ways to triangulate a pentagon |
| 4 | 14 | 14 valid parentheses strings with 4 pairs |
| 6 | 132 | 132 Dyck paths of semilength 6 |
| 10 | 16796 | 16796 non-crossing partitions of 10 elements |
The generating function C(x) = Σn≥0 Cn xn satisfies C(x) = 1 + x C(x)2, leading to C(x) = (1 - √(1-4x))/(2x). This functional equation is central in analytic combinatorics and allows the derivation of the asymptotic formula. Our calculator uses direct combinatorial evaluation, but the underlying mathematics ensures complete reliability.