Keep or Swap
Eight people each bring one gift. Afterwards every person ends up holding exactly one gift, and the only exchanges allowed are pairwise swaps: each person either keeps their own gift or swaps gifts with exactly one other person (who then holds theirs). No one takes part in more than one swap. How many different final assignments of gifts to people are possible (including the one where nobody swaps)? Give an integer.
Related problems & prerequisites
Worth solving first
- The Frog and Twenty Pads 5.0/10
Source: Classic exercise in wide circulation; no traceable original source. Statement written for AxiomIQ.