Mathematics (JEE)HardCodeforces Div2 D
How many subsets of {1, 2, ..., 12} (including the empty set) contain no two elements whose difference is 1 or 2?
- A. 4096
- B. 377
- C. 128
- D. 129
Correct answer: D. 129
With a(n) for subsets of {1..n}: either n is absent, giving a(n-1), or n is present and n-1, n-2 are absent, giving a(n-3). With a(0)=1, a(1)=2, a(2)=3 this gives a(12) = 129.
Practise more Permutations, Combinations and Probability questionsPermutations, Combinations and Probability: notes and key points
More Permutations, Combinations and Probability questions
- How many 4-element subsets of {1, 2, ..., 20} contain no two consecutive integers?
- How many integers from 1 to 1000 are divisible by none of 2, 3, 5 and 7?
- How many strings of length 6 over {a, b, c} use all three letters and have no two equal adjacent letters?
- Two fair dice are rolled. Given that the sum is even, what is the probability that the sum is 8?
- Two cards are drawn without replacement from a set of 8 cards made of 4 aces and 4 kings. Given that at least one of the two cards is a…
- Four letters are placed at random into four envelopes, one letter per envelope. What is the probability that exactly two letters go into…