GATE Computer ScienceVery hardGATE CS

In how many permutations of 1, 2, …, 7 does no entry i + 1 immediately follow the entry i (that is, there is no adjacent pair i, i + 1 in this order)?

  1. A. 2119
  2. B. 1854
  3. C. 2161
  4. D. 2072

Correct answer: A. 2119

Inclusion–exclusion over the 6 possible 'successions': Σ (−1)ᵏ C(6, k) (7 − k)! = 5040 − 4320 + 1800 − 480 + 90 − 12 + 1 = 2119. The number of derangements of 7 elements, 1854, is a common wrong answer.

More Discrete Mathematics questions

Exams that ask this topic