I was looking at the description of a derangement that states "a derangement is a permutation of the elements of a set such that none of the elements appear in their original position". But then it gave 9 derangements for a set of 4 items. That doesn't make sense to me, because I only get 4 discrete sets from 4 items.
For example:
1234 3142 2413 4321
Is there a different term than derangement for sets where the numbers don't have the same order as in any other set, based on a particular number of items?
And does anyone know of an algorithm for generating the derangements?