In combinatorics, the Narayana numbers N(n, k), n = 1, 2, 3 …, 1 <= k <= n, form a triangular array of natural numbers, called Narayana triangle. It is given by :
Narayana numbers N(n, k) can be used to find the number of expressions containing n-pairs of parentheses, which are correctly matched and which contain k distinct nesting.
For instance, N(4, 2) = 6 as with four pairs of parentheses six sequences can be created which each contain two times the sub-pattern ‘()’ :
()((())) (())(()) (()(())) ((()())) ((())()) ((()))()
Input : n = 6, k = 2 Output : 15 Input : n = 8, k = 5 Output : 490
Below is the implementation of finding N(n, k) :
- Count number of triplets with product equal to given number with duplicates allowed
- Count number of triplets with product equal to given number with duplicates allowed | Set-2
- Given number of matches played, find number of teams in tournament
- Super Ugly Number (Number whose prime factors are in given set)
- Finding number of digits in n'th Fibonacci number
- Number of compositions of a natural number
- Check if a number is Flavius Number
- Get the kth smallest number using the digits of the given number
- Check if a number is an Achilles number or not
- Check if the given number is Ore number or not
- Number of digits in the nth number made of given four digits
- Motzkin number
- Leyland Number
- Entringer Number
- Icosahedral Number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.