Counting & Number Theory
Catalan Balanced Parentheses & Lattice Path Calculator
Count balanced parenthesis strings, nonnegative balanced walks and equivalent Catalan structures.
How the calculation works
Catalan C(n) = binomial(2n,n)/(n+1), computed as an exact integer. The unrestricted equal-count strings number binomial(2n,n), so the properly nested fraction is 1/(n+1).
Worked example
Example inputs — Number of parenthesis pairs / up-steps n: 5. Expected results — Catalan balanced-structure count: 42; All strings with n opens and n closes: 252; Fraction of balanced-count strings that are properly nested: 0.1666666667 fraction.
Assumptions and limits
Exact integer arithmetic is used for counts and integer results. Computation limits keep this browser tool responsive. Specify whether objects/groups are distinguishable and whether order matters; different conventions count different outcomes. Parentheses have one type. Equivalent interpretations include paths with n up and n down steps that never go below zero. The unrestricted comparison already fixes equal open/close counts; it is not all 2^(2n) binary strings. The empty structure counts as one.
Reference and further reading
Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.
Related calculators
- Modular Power, Inverse & Bezout Calculator
- Chinese Remainder & Compatible Congruences Calculator
- Prime Factorization, Divisors & Totient Calculator
- Exact Integer Base 2–36 Converter
- Decimal to Best Bounded-Denominator Fraction Calculator
Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.