Skip to main content
Calcimator

Catalan Number Calculator

Calculate Catalan numbers and their combinatorial interpretations including binary trees and lattice paths.

About this calculator

A Catalan number counts several different combinatorial structures that all happen to share exactly the same count, which is part of what makes the sequence worth knowing. The number of structurally distinct full binary trees built from n+1 leaves, the number of monotonic lattice paths from one corner of an n-by-n grid to the opposite corner that never rise above the diagonal, and the number of ways to fully and validly parenthesize a string of n+1 factors are all the identical number, C(n). This calculator gets there through the closed-form formula C(n) equals C(2n, n) divided by (n + 1), computing the central binomial coefficient first and then dividing, rather than actually building and counting trees or paths. Raising n does not just raise the count — it raises it at an accelerating rate, since the ratio between one Catalan number and the next climbs steadily toward 4 as n grows (it is 2.5 at n = 3, reaches exactly 3.5 at n = 11, and hits roughly 3.81 by n = 30) without ever quite touching 4.

The input tops out at n = 30 for a concrete reason: that is the largest index whose true Catalan number is still exactly representable as a JavaScript number. One step further, at n = 31, the true value already exceeds the largest integer double-precision floating point can represent without rounding error, so the field simply will not accept a larger index. Missing from this calculator: it never lists the actual binary trees, lattice paths, or parenthesizations it is counting — only the count itself — and there is no way to jump straight to one very large index without rendering the whole climbing sequence up to it in the chart.

Inputs

Results

Catalan Number C(n)

42

Full Binary Trees (n+1 leaves)42
Monotonic Lattice Paths42
How to Use This Calculator
  1. Enter n to compute the nth Catalan number.
  2. Review Catalan Number C(n) — the count of valid parenthesization sequences and monotonic paths.
  3. Check Full Binary Trees (n+1 leaves) to see the structural interpretation.
  4. Use Monotonic Lattice Paths for counting grid-path problems in combinatorics.
  5. For large n, note that Catalan numbers grow as 4^n divided by n^1.5 times sqrt(pi).

How the result changes with n

nCatalan Number C(n)
2.55
3.7514
7.51,430
13742,900

What each input means

n
Index of the Catalan number to compute (C_n). Maximum 30 to avoid overflow.

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    n = 5 = 1 input(s) provided
  2. Calculate Catalan Number C
    Catalan Number C
    42 = 42
  3. Calculate Full Binary Trees
    Full Binary Trees
    42 = 42
  4. Calculate Monotonic Lattice Paths
    Monotonic Lattice Paths
    42 = 42

Engine last updated . Checked against 5 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.

Frequently Asked Questions

Why do binary trees, lattice paths, and parenthesizations all give the same count?

All three problems can be translated into each other through a well-known combinatorial correspondence: a valid sequence of balanced parentheses maps one-to-one onto a monotonic lattice path that never crosses the diagonal, and that same path maps one-to-one onto the shape of a full binary tree. Because a one-to-one correspondence preserves count, all three structures share exactly one number for a given n.

Why is the input capped at n = 30?

At n = 30, the true Catalan number is 3,814,986,502,092,304 — large, but still small enough that JavaScript's number type stores it with no rounding error. The very next value, at n = 31, is more than 14 quadrillion and already exceeds the largest integer a standard double-precision number can represent exactly, so allowing it would silently return a wrong answer instead of a correct one.

Does the ratio between consecutive Catalan numbers ever actually reach 4?

No, not for any finite n. The ratio climbs steadily — 2.5 at n = 3, exactly 3.5 at n = 11, and around 3.81 by n = 30 — but it only approaches 4 as a limit as n grows without bound; within the calculator's allowed range it always stays measurably below 4.

What formula does the calculator actually use to compute C(n)?

It uses the closed-form identity C(n) equals C(2n, n) divided by (n + 1), where C(2n, n) is the standard binomial coefficient — the number of ways to choose n items from 2n. This is computed directly rather than through the sequence's recursive definition, which is why the calculator can jump straight to a high index like n = 27 without working through every smaller term first.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Math & Statistics.