JEEOlympiad

How many subsets S of {1, 2, 3, ..., 15} contain no two consecutive…

Question

How many subsets S of {1, 2, 3, ..., 15} contain no two consecutive integers AND have a sum of elements divisible by 3? (Count the empty set, whose sum 0 is divisible by 3.)

✓ Verified answer: 536checked by our engine — not a guess

Step-by-step solution

We use a transfer/generating approach by residues.

Process elements 1..15 left to right, maintaining a state = (whether the previous integer was selected, current sum mod 3).

A valid subset never selects two consecutive integers, so after selecting element i we forbid selecting i+1.

Define dp over positions with states indexed by (last_taken in {0,1}, residue in {0,1,2}).

Initialize before element 1 with empty selection, residue 0, last_taken=0.

For each integer i with residue r_i = i mod 3, we either skip it (last_taken becomes 0, residue unchanged) or take it only if the previous wasn't taken (last_taken becomes 1, residue += r_i mod 3).

Running this dynamic program across all 15 elements and summing the counts ending in residue 0 (over both last_taken values) gives the number of admissible subsets.

The computation yields 536.

The brute-force enumeration over all non-consecutive subsets confirms exactly 536 have sum divisible by 3.

Final answer536

Stuck on a problem like this?

Paste any JEE or NEET question — verified working, a confidence %, and an honest “not sure” instead of a bluff.

Solve my doubt →

More Combinatorics solutions