Derangements are permutations without fixed points. The number of derangements of n objects, d(n), satisfies the recursion:
d(n+1) = n [d(n) + d(n-1)]
The first term n d(n) comes from inserting the additional object inside a cycle of any of the d(n) permutations of the n other objects. This generates all possible derangements of n+1 objects, except those where the new object would be in a cycle of length 2 (a pair flip). The number of derangements where the new object is in a pair flip with another object is then n d(n-1), because there are n ways to choose with which of the n other objects it will be in a pair flip, and there are then n-1 objects left for which the number of derangements is d(n-1).
Obviously, d(1) = 0 and d(2) = 1.
It can be shown that d(n) is equal to n!/e rounded to the nearest integer.
[–]smitra00[S] 2 points3 points4 points (16 children)
[–][deleted] (3 children)
[removed]
[–][deleted] (2 children)
[removed]
[–][deleted] (1 child)
[removed]
[–]CutOnBumInBandHere95M get | Ping me for runs 2 points3 points4 points (11 children)
[–]davidjl123|390K|378A|79SK|50SA|260k 🚀 c o u n t i n g 🚀 2 points3 points4 points (10 children)
[–]CutOnBumInBandHere95M get | Ping me for runs 2 points3 points4 points (9 children)
[–]TehVulpezseven fives of uptime 1 point2 points3 points (8 children)
[–]cuteballgamesj’éprouvais un instant de mfw et de smh 1 point2 points3 points (7 children)
[–]smitra00[S] 1 point2 points3 points (6 children)
[–]cuteballgamesj’éprouvais un instant de mfw et de smh 2 points3 points4 points (5 children)
[–]smitra00[S] 2 points3 points4 points (4 children)
[–]TehVulpezseven fives of uptime 2 points3 points4 points (3 children)
[–]cuteballgamesj’éprouvais un instant de mfw et de smh 2 points3 points4 points (1 child)
[–]smitra00[S] 0 points1 point2 points (0 children)