Calculators
Narayana Number Calculator
Calculate exact Narayana numbers for indices 0 to 1000 privately in your browser, with C(n, k) binomial terms and digit counts.
Count Dyck paths by their number of peaks.
The Narayana number N(n, k) = (1 ÷ n) × C(n, k) × C(n, k − 1) counts Dyck paths with n up-steps and exactly k peaks, as well as rooted ordered trees with n edges and k leaves and 231-avoiding permutations with k descents. The row for n = 4 is 1, 6, 6, 1; for n = 5 it is 1, 10, 20, 10, 1. For example, N(5, 3) = (1 ÷ 5) × 10 × 10 = 20. Summing N(n, k) over k from 1 to n gives the nth Catalan number, and each row is symmetric because reversing a path swaps peaks with valleys. The convention N(0, 0) = 1 covers the single empty path. Enter n from 0 to 1000 using one to four digits and k from 1 to n; leading zeros and surrounding whitespace are accepted, while signs, decimals, separators and scientific notation are rejected. Exact BigInt arithmetic preserves every digit. 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 Narayana number count?
The Narayana number N(n, k) counts Dyck paths with n up-steps and exactly k peaks. The same number also counts rooted ordered trees with n edges and k leaves and 231-avoiding permutations with k descents. For example, N(5, 3) = 20.
How are Narayana numbers calculated?
The formula is N(n, k) = (1 ÷ n) × C(n, k) × C(n, k − 1), where C is the binomial coefficient. Both binomial terms are computed with exact BigInt arithmetic, then divided by n, so the result is always a whole number with no rounding.
How are Narayana numbers related to Catalan numbers?
Summing N(n, k) over all k from 1 to n gives the nth Catalan number. For example, the n = 5 row is 1, 10, 20, 10, 1 and totals 42, which is C(5). Each row is symmetric because reversing a path swaps peaks with valleys.
Which inputs are supported?
Enter n from 0 to 1000 and k from 1 to n using digits only. The single convention N(0, 0) = 1 covers the empty path. Leading zeros and surrounding whitespace are accepted, while signs, decimals, separators and scientific notation are rejected. A peak count above n shows a clear error.
Do my numbers stay private?
Yes. The calculation and copy action run locally in your browser with exact BigInt arithmetic. CodeASystem does not upload or store the values you enter.