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)?
- A. 2119
- B. 1854
- C. 2161
- 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
- How many pairwise non-isomorphic simple graphs (not necessarily connected) have 6 vertices and exactly 7 edges?
- A necklace has 8 beads, each coloured with one of 3 colours so that adjacent beads (including the last and first) have different colours…
- What is the value of Σ{k=1}^{100} gcd(k, 100)?
- What is the size of a maximum cut of the Petersen graph (the largest number of edges between a vertex set S and its complement)?
- How many Latin squares of order 4 are there (4 × 4 arrays over {1, 2, 3, 4} in which every row and every column contains each symbol…
- In the game of Nim with piles of 9, 12, 17, 21, 30 and 6 stones, a move removes any positive number of stones from a single pile. How many…