Calculates the numbers of involutions of 0 through \e n objects.

View versions (1)

Interface

#include <codecogs/maths/combinatorics/sequences/involution_numbers_list.h>

using namespace Maths::Combinatorics::Sequences;

This function calculates the number of involutions for 0 through n objects, using the following recurrent sequence:

S(n) = S(n-1) + (n-1)S(n-2), \qquad S(0) = S(1) = 1
(1)

An involution is a permutation consisting only of fixed points and pairwise transpositions. It can be proven that to every involution there is a unique corresponding inverse.

Example 1

#include <codecogs/maths/combinatorics/sequences/involution_numbers_list.h>
#include <iostream>
int main() {
  std::vector<int> result = Maths::Combinatorics::Sequences::involution_numbers_list(10);
  std::cout << "Number of values: " << result.size() << std::endl;
  for (int i = 0; i < result.size(); i++)
    std::cout << result[i] << "  ";
  std::cout << std::endl;
  return 0;
}

Output:

Number of values: 11
1  1  2  4  10  26  76  232  764  2620  9496

Returns

the involution numbers of order 0 to n

References

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

GPL Licence — free for non commercial use. See Licence details.