Catalan Number Calculator - Cₙ Formula and Sequence List

Catalan index is exactly the number you typed.

The 5th Catalan number, C₅

42

C₅ = 42 — the same count for 5 bracket pairs, a 5-node binary tree and a triangulated 7-sided polygon.

Three routes to the same answer

Closed form — divide the central binomial

C(10, 5) = 252 ÷ 6 = 42

Ratio step — one multiply from the term before

14 × 2(9) ÷ 6 = 42

Growth factor 2(2n−1)/(n+1) = 3.0000 — it climbs toward 4 and never reaches it.

Segner's recurrence — split at the first return

C₀·C₄ + C₁·C₃ + C₂·C₂ + C₃·C₁ + C₄·C₀ = 14 + 5 + 4 + 5 + 14 = 42

Eight problems that all answer 42

Same number, different question — note how each one reads its size off a different place.

Balanced bracket strings

42

from 5 pairs of ( )

Binary trees

42

from 5 nodes

Polygon triangulations

42

from a convex 7-gon

Ways to bracket a product

42

from 6 factors

Monotone lattice paths

42

from the 5 × 5 grid, under the diagonal

Non-crossing handshakes

42

from 10 people in a circle

Non-crossing partitions

42

from a set of 5 elements

Stack-sortable permutations

42

from 5 items through one stack

Every balanced string, drawn as a mountain range

Each “(” steps up, each “)” steps down. A string is balanced exactly when the path never dips below the baseline and finishes on it.

((((()))))

(((()())))

(((())()))

(((()))())

(((())))()

((()(())))

((()()()))

((()())())

((()()))()

((())(()))

((())()())

((())())()

((()))(())

((()))()()

(()((())))

(()(()()))

(()(())())

(()(()))()

(()()(()))

(()()()())

(()()())()

(()())(())

(()())()()

(())((()))

(())(()())

(())(())()

(())()(())

(())()()()

()(((())))

()((()()))

()((())())

()((()))()

()(()(()))

()(()()())

()(()())()

()(())(())

()(())()()

()()((()))

()()(()())

()()(())()

()()()(())

()()()()()

That is all 42 of them, with nothing repeated and nothing missing.

Previous C₄

14

the term one step back

Next C₆

132

one step forward

Central binomial C(10, 5)

252

all paths, before the bad ones are removed

Digits

2

≈ 5.167 × 10^1 from 4ⁿ/(n^1.5·√π), 23.03% high

The Catalan numbers, C₀ to C₂₀

nCnDigitsCn / Cn−1
011
1111.000
2212.000
3512.500
41422.800
54223.000
613233.143
742933.250
81,43043.333
94,86243.400
1016,79653.455
1158,78653.500
12208,01263.538
13742,90063.571
142,674,44073.600
159,694,84573.625
1635,357,67083.647
17129,644,79093.667
18477,638,70093.684
191,767,263,190103.700
206,564,120,420103.714

The last column is the whole story of how fast these grow: it rises steadily toward 4 but never gets there, which is why Cn lands just under 4ⁿ divided by a polynomial.

Work backwards from a count

Handy when you have counted something by hand and want to know which n it belongs to.

Yes — 429 is C

So whatever you counted has 7 pairs, 7 nodes, or a 9-gon behind it, depending on the problem.

How to Use This Calculator

  1. Pick your problem in What are you counting? If you just want the term itself, leave it on The nth Catalan number.
  2. Type the size into the box beside it. The label changes with your choice — sides for a polygon, factors for a product, nodes for a tree — and the tool converts it to the right Catalan index for you.
  3. Read the green banner first. It states the answer in your own units and, when the index differs from what you typed, says exactly why.
  4. Open Three routes to the same answer to see the arithmetic worked by the closed form, by one multiplication from the previous term, and by Segner's convolution.
  5. For n of 7 or less, scroll to the mountain-range gallery — every balanced string is drawn out, so you can check a hand count against the picture.
  6. Already have a count and want the index? Put it in Is this number in the sequence? at the bottom.

Share this calculator

Help others solve their calculations

Found this calculator helpful? Share it with your friends, students, or colleagues who might need it!

Catalan Number Calculator: Counting Trees, Paths, and Parentheses

About the Author

Marko Šinko - Co-Founder & Lead Developer

Marko Šinko

Co-Founder & Lead Developer, AI Math Calculator

Lepoglava, Croatia
Advanced Algorithm Expert

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Co-founder of award-winning projects, ensuring precise mathematical computations and reliable calculator tools.

📅 Published:
Catalan Number Calculator illustration showing binary trees, balanced parentheses, a mountain-range path and a triangulated polygon

Set the Catalan number calculator above to n = 5 and it returns 42. That same 42 counts the binary trees you can build from five nodes, the ways to slice a seven-sided polygon into triangles, the bracketings of a six-factor product, and the handshakes ten people around a table can manage without anyone’s arms crossing. Four problems from four corners of mathematics, one answer. That is not a coincidence anyone planned — it is what makes the sequence 1, 1, 2, 5, 14, 42, 132, 429 worth knowing on sight.

The tool handles the part that trips people up: which index you actually need. A heptagon wants C5, six factors want C5, five nodes want C5, and none of those inputs is the number 5. Pick your problem from the dropdown, type its natural size, and the conversion happens before the arithmetic. Below: why the formula divides by n + 1, the three ways to compute Cn and the one that survives large inputs, and how fast these numbers really grow.

One Count, Eight Problems, Eight Different Indexes

Two counting problems have the same answer for a reason, and the reason is usually a bijection — a way of turning any solution to one problem into exactly one solution of the other. Take a balanced bracket string and read it as instructions for building a tree: every “(” means descend into a child, every “)” means climb back up. Nothing is lost and nothing is duplicated, so the two counts must match. String the bijections together and one sequence ends up counting all of this:

What you are countingIndex you needAnswer at C₅ = 42
Balanced strings of bracketsn = pairs5 pairs → 42 strings
Binary treesn = nodes5 nodes → 42 trees
Triangulating a convex polygonn = sides − 27-gon → 42 triangulations
Bracketing a productn = factors − 16 factors → 42 bracketings
Lattice paths under the diagonaln = grid width5 × 5 grid → 42 paths
Non-crossing handshakes in a circlen = people ÷ 210 people → 42 pairings
Non-crossing partitions of a setn = elements5 elements → 42 partitions
Permutations sortable by one stackn = items5 items → 42 orders

Look down the middle column and you can see where the errors come from. Three of those problems take the index straight, one subtracts 1, one subtracts 2, and one halves. Richard Stanley collected more than 200 such interpretations; the OEIS entry A000108 is the canonical reference if you want to check whether your own problem belongs on the list.

Why a Catalan Number Calculator Divides by n + 1

The Catalan number formula looks like an ordinary binomial coefficient with a stray divisor bolted on:

Cₙ = C(2n, n) / (n + 1) = (2n)! / (n! · (n+1)!)

That divisor is not cosmetic, and it is not an average of anything. It falls out of a counting argument known as the reflection method, and the cleanest way to see it is with lattice paths. Suppose you walk from the bottom-left corner of a grid to the top-right using n steps right and n steps up. The total number of routes is just the number of ways to choose which of the 2n steps go right — that is C(2n, n), and any combination calculator will give it to you. For n = 3 that is C(6, 3) = 20.

Now add the restriction that matters: the path must never rise above the diagonal. In bracket language, you may never close a bracket you have not opened. A bad path is one that touches the forbidden line y = x + 1 at some point. Here is the trick — take the first moment a bad path touches that line and reflect everything after it, swapping every right step for an up step. What you get is a path to a different corner, one step over, and the correspondence runs both ways: every bad path becomes exactly one path to that shifted corner, and every path to the shifted corner comes from exactly one bad path.

So the number of bad paths is C(2n, n+1). Subtract:

All paths (n = 3):   C(6, 3) = 20

Bad paths:           C(6, 4) = 15

Good paths:          20 − 15 = 5 = C₃

Five, and you can list them by hand: ()()(), ()(()), (())(), (()()), ((())). Do the algebra on C(2n, n) − C(2n, n+1) and the whole thing collapses to C(2n, n)/(n + 1). Three quarters of all paths were illegal at n = 3, and it gets worse: at n = 10 only 16,796 of the 184,756 possible paths survive, under 10%. That is why you can never just count arrangements with a permutation calculator and hope the invalid ones are a rounding error.

Three Ways to Compute Cₙ, and When Each One Breaks

Every route below gives the same answer for small n. They part company badly once the numbers grow, and the failure is usually silent — you get a plausible-looking integer that happens to be wrong.

MethodCostWhere it breaks
Factorials: (2n)! / (n!(n+1)!)O(n)Worst option. 171! overflows a double, and the intermediates dwarf the answer — C₅ = 42 is computed from 10! = 3,628,800
Central binomial ÷ (n+1)O(n)C(2n, n) passes 2⁵³ at n = 29, so floating-point results turn wrong roughly seven terms before Cn itself does
Ratio step: Cₙ = Cₙ₋₁ · 2(2n−1)/(n+1)O(n)Nothing intermediate exceeds the answer; every division is exact. The default for a single term
Segner: Cₙ = Σ Cᵢ · Cₙ₋₁₋ᵢO(n²)Slow, but it is the shape most dynamic-programming problems actually need

The hard numbers are worth committing to memory if you write code that touches this sequence. C36 = 11,959,798,385,860,453,492 is the first Catalan number too big for a signed 64-bit integer, and C37 breaks unsigned. Long before that, at n = 29, the central binomial C(58, 29) = 30,067,266,499,541,040 has already passed the point where a double-precision float can hold every integer exactly. If your language stores integers as doubles — JavaScript without BigInt, for one — the closed form starts returning confidently wrong values from n = 29 onwards while C29 itself is still perfectly representable. The calculator above sidesteps all of it by running the ratio step on exact big integers, the same reason a factorial calculator has to abandon floats early.

Segner's recurrence earns its keep elsewhere. Written out, C5 = C₀C₄ + C₁C₃ + C₂C₂ + C₃C₁ + C₄C₀ = 14 + 5 + 4 + 5 + 14 = 42. Each term splits a structure at a chosen point: for a bracket string, at the position where the opening bracket finally closes, leaving i pairs inside and n−1−i pairs after. That decomposition is exactly what you implement when a problem asks for optimal matrix-chain bracketing or the best binary search tree — you are not counting the arrangements, you are searching them, and the recurrence tells you the search has Cn leaves. It also has a tidy generating function, (1 − √(1 − 4x))/2x, which a generating function calculator can expand term by term.

The Off-by-One That Turns 42 Into 132

Ask how many ways there are to bracket a product of six factors. The instinct is to reach for C6 = 132. The right answer is C5 = 42, and the reason is the same one that makes handshake problems awkward: the last operation is not free. Six factors need five multiplications, and it is the multiplications you are arranging, not the factors. Same story with the polygon — a triangulated heptagon has seven sides but only five triangles, so it is C5 again, not C7.

Four traps, in the order people fall into them:

  • Counting objects instead of operations. Factors, polygon sides and tree leaves all sit one or two above the index. Nodes, bracket pairs and grid width sit exactly on it. The dropdown in the calculator exists for precisely this.
  • Forgetting the divisor. C(2n, n) on its own counts every arrangement, legal or not. At n = 5 that is 252 rather than 42 — six times too many.
  • Reading “the 5th Catalan number” as C₅. The sequence is conventionally indexed from C₀ = 1, so the fifth term written down is C₄ = 14. When someone says the fifth Catalan number, ask which they mean; papers and textbooks split on it.
  • Assuming both children of a tree node are interchangeable. Binary trees count left and right as distinct, which is what makes them Catalan. Drop that distinction and you are counting something else entirely, with a smaller answer.

A quick sanity check catches most of these: Cn for small n runs 1, 1, 2, 5, 14, 42. If your hand count of a four-object problem gives anything other than 5 or 14, you are on the wrong index. And if it lands between two terms — 100, say, which sits between C₆ = 132 and C₅ = 42 — it is not a Catalan problem at all, or you have miscounted. The reverse lookup at the bottom of the calculator answers that question directly.

How Fast They Grow, and Why It Matters for Code

Catalan numbers grow almost exponentially, but not quite. The ratio between consecutive terms is exactly 2(2n − 1)/(n + 1), which is 2.5 at n = 3, 3.714 at n = 20, and 3.96 at n = 100. It climbs toward 4 forever and never arrives. The consequence is the asymptotic form:

Cₙ ≈ 4ⁿ / (n^(3/2) · √π)

That estimate runs about 9/(8n) high, so it is 11% over at n = 10, 5.7% over at n = 20, and just 1.1% over at n = 100 — useful for sizing a problem, useless for an exact answer. The practical numbers: C20 = 6,564,120,420, C50 is 28 digits long, and C100 = 896,519,947,090,131,496,687,170,070,074,100,632,420,837,521,538,745,909,320, all 57 digits of it.

Those figures decide algorithm design more often than people expect. If your program enumerates every binary tree on 20 nodes, you are asking it to produce six and a half billion objects — that job is not slow, it is impossible on a laptop. Thirty nodes puts you at 3.8 quadrillion. Any Catalan-shaped search space has to be pruned or solved with dynamic programming; brute force dies somewhere around n = 15, where 9,694,845 cases are still merely tedious rather than fatal.

Compare that with the Fibonacci sequence, whose ratio settles at 1.618 and which only reaches 6,765 by its twentieth term. Both come from simple recurrences, but the growth constants — 4 against 1.618 — put them in different computational worlds. A Fibonacci-sized search space is something you can walk through. A Catalan-sized one you have to be clever about.

Frequently Asked Questions

Still Have Questions?

The detailed content on this page provides comprehensive explanations and examples to help you understand better.