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

View versions (1)

Interface

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

using namespace Maths::Combinatorics::Arithmetic;

The falling factorial has the following formula

[x]_n = \prod_{i = 0}^{n - 1} (x - i) = x! / n!
(1)

Note that the number of <em> injections </em> or 1-to-1 mappings from a set of n elements to a set of m elements is [m]_n. The number of permutations of n objects out of m is [m]_n. Moreover, the Stirling numbers of the first kind can be used to convert a falling factorial into a polynomial, as follows:

[x]_n = \sum_{i = 0}^n S^i_n x^i
(2)

Example:

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

Output:

12

References

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

Parameters

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

Returns

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

Interactive Calculator

x
n
Result