In combinatorics, the Eulerian Number E(n, m), is the number of permutations of the numbers 1 to n in which exactly m elements are greater than previous element.
E(m,n) = 0 if(m >= n || n == 0)
E(m,n) = 1 if (m == 0)
E(m,n) = (n - m) * E(n - 1, m - 1) + m + 1) * E(n - 1, m) otherwise
Input : n = 3, m = 1
Output : 4
Please see above diagram (There
are 4 permutations where 1 no. is
greater.
Input : n = 4, m = 1
Output : 11