Calculates the rising factorial with arguments \e x and \e n.

You're viewing an older version of this page (#5334). View the current version.

View versions (2)

Interface

#include <codecogs/maths/combinatorics/arithmetic/rising_factorial.h>

using namespace Maths::Combinatorics::Arithmetic;

The rising factorial has the following formula

$$[x]^n = \prod_{k = 0}^{n - 1} (x + k)$$
(1)

Note that the number of ways of arranging n objects in m ordered boxes is $[m]^n$. (Here, the ordering in each box matters). Thus, 2 objects in 2 boxes have the following 6 possible arrangements:

$$-/12 \qquad 1/2 \qquad 12/- \qquad -/21 \qquad 2/1 \qquad 21/-$$
(2)

Moreover, the number of non-decreasing maps from a set of n to a set of m ordered elements is $[m]^n / n!$. Thus the set of nondecreasing maps from $(1,2,3)$ to $(a,b,c,d)$ is the 20 elements:

$$aaa \quad abb \quad acc \quad add \quad aab \quad abc \quad acd \quad aac \quad abd \quad aad$$
(3)
$$bbb \quad bcc \quad bdd \quad bbc \quad bcd \quad bbd \quad ccc \quad cdd \quad ccd \quad ddd$$
(4)

Example:

#include <codecogs/maths/combinatorics/arithmetic/rising_factorial.h>
#include <iostream>
int main()
{
  std::cout << Maths::Combinatorics::Arithmetic::rising_factorial(5, 3) << std::endl;
  return 0;
}

Output:

210

References

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

Parameters

x
the first rising factorial argument
n
the second falling factorial argument

Returns

the rising factorial of the pair of values x and n
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
n
Result