Narayana Number
Count Dyck paths of semilength n with k peaks as an exact Narayana number, using N(0,0)=1 and zero outside the counting range; indices are capped at 500.
Description
Narayana numbers refine Catalan counts by the number of peaks in a Dyck path.
Narayana numbers refine Catalan counts by the number of peaks in a Dyck path. Both the path semilength and exact peak count determine the result.1
The tool returns value. The indexing and output conventions below determine how to read these values.
When to use Narayana Number
Use this for the following task: Count Dyck paths of semilength n with k peaks as an exact Narayana number, using N(0,0)=1 and zero outside the counting range; indices are capped at 500. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Narayana Number and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter n, k according to the field table, then run the tool.
- Read value. Preserve exact decimal strings and the stated indexing or coefficient order.
- Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| n | Dyck path semilength (resource limit 500) | integer; minimum 0; maximum 500 | Required |
| k | Peak count (resource limit 500) | integer; minimum 0; maximum 500 | Required |
Handle the empty path with N(0,0)=1, return zero for other impossible peak counts, and evaluate the binomial product with BigInt division.
N(n,k)=C(n,k)×C(n,k−1)/n for n>0 and 1≤k≤n The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| value | Narayana number | string (integer/arbitrary) |
{
"input": {
"n": 5,
"k": 3
},
"output": {
"value": "20"
}
} Limitations and assumptions
Both indexes are at most 500. The tool counts paths without enumerating them, and k means peaks rather than arbitrary steps.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Fuss–Catalan Number when you need its operation: Return the exact p-ary tree Fuss–Catalan number C(pn,n)/((p−1)n+1), with p≥2 and pn≤5,000 as a computation resource limit. Choose Catalan Triangle Entry for the complementary operation: Return the ballot-number Catalan triangle entry T(n,k)=C(n+k,k)−C(n+k,k−1), with zero outside 0≤k≤n and indices capped at 500.
Background reference: OEIS A001263.
References
-
OEIS A001263 — OEIS Foundation
Similar or alternative tools
- Fuss–Catalan Number
Return the exact p-ary tree Fuss–Catalan number C(pn,n)/((p−1)n+1), with p≥2 and pn≤5,000 as a computation resource limit.
- Catalan Triangle Entry
Return the ballot-number Catalan triangle entry T(n,k)=C(n+k,k)−C(n+k,k−1), with zero outside 0≤k≤n and indices capped at 500.