Derangements Number
Calculates the number of derangements of \e n objects.
Controller: CodeCogs
Interface
C++
Excel
Derangements Number
intderangements_number( | int | n | ) |
Example:
#include <codecogs/maths/combinatorics/sequences/derangements_number.h> #include <iostream> int main() { for (int i = 0; i < 10; i++) std::cout << i << " " << Maths::Combinatorics::Sequences::derangements_number(i) << std::endl; return 0; }
Output:
0 1 1 0 2 1 3 2 4 9 5 44 6 265 7 1854 8 14833 9 133496
References:
SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.htmlParameters
n the number of objects
Returns
- the number of derangements of n objects
Authors
- Lucian Bentea (August 2005)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.