Calculators

Motzkin Number Calculator

Calculate exact Motzkin numbers for indices 0 to 1000 privately in your browser, with the next term and digit count.

Calculate a term in the Motzkin sequence and the following term. Exact BigInt arithmetic keeps every digit. Your data stays in your browser.

Enter a whole number from 0 to 1000 using digits only. Zero returns 1. The sequence starts 1, 1, 2, 4, 9, 21.

Your Motzkin number will appear here.

Count non-intersecting chord diagrams and lattice paths.

The Motzkin number M(n) counts ways to draw non-intersecting chords between n points on a circle, paths from (0,0) to (n,0) using steps (1,1), (1,0), (1,−1) that never go below the x-axis, and ways to parenthesize a product of n+1 factors using binary and unary operators. The sequence starts M(0) = 1, M(1) = 1, M(2) = 2, M(3) = 4, M(4) = 9, M(5) = 21. The recurrence is M(n) = M(n − 1) + Σ M(k) × M(n − 2 − k) for k = 0 to n − 2, with M(0) = M(1) = 1. For example, M(4) = M(3) + M(0)M(1) + M(1)M(0) = 4 + 1 + 1 = 9. Enter an index from 0 to 1000 using one to four digits; leading zeros and surrounding whitespace are accepted. Signs, decimals, separators and scientific notation are rejected. Exact browser BigInt arithmetic preserves every digit. Results include the selected term, its decimal digit count and the next term. All calculations stay in your browser.

Frequently Asked Questions

Everything you need to know about this tool, how it works, and privacy.

What does a Motzkin number count?

M(n) counts ways to draw non-intersecting chords between n points on a circle, lattice paths from (0,0) to (n,0) with steps (1,1), (1,0), (1,−1) that never go below the x-axis, and ways to parenthesize n+1 factors using binary and unary operators. M(4) = 9, M(5) = 21.

How are Motzkin numbers related to Catalan numbers?

Catalan numbers count the same chord diagrams and paths but without the horizontal (1,0) step. Motzkin numbers generalize Catalan numbers by allowing flat steps. Every Catalan structure is also a Motzkin structure.

Which starting values does this calculator use?

M(0) = 1 and M(1) = 1. The recurrence M(n) = M(n − 1) + Σ M(k) × M(n − 2 − k) for k = 0 to n − 2 produces 1, 1, 2, 4, 9, 21, 51, 127.

Which inputs are supported?

Enter an index from 0 to 1000 using one to four digits. Leading zeros and surrounding whitespace are accepted. Signs, decimals, separators and scientific notation are rejected. Calculations run locally in your browser with exact BigInt arithmetic.