2016 cards are arranged in a row on a table. One of the numbers ‘1’, ‘2’ and ‘3’ is printed on each card.

It is found that there is at least one card between any two cards labelled ‘1’, at least two cards between any two cards labelled ‘2’, and at least three cards between any two cards labelled ‘3’.

If the smallest and greatest possible numbers of cards labelled ‘3’ are $m$ and $M$ respectively, find the value of $m+M$ .

The answer is 1008.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

Consider any 4 consecutive cards.

There can be at most one ‘3’ since there are at least three cards between any two ‘3’s.

On the other hand, there is at least one ‘3’, for otherwise they have to be ‘1’s and ‘2’ subject to the required conditions, which can easily be seen to be impossible.

In other words, there is exactly one ‘3’ among any 4 consecutive cards.

Since $2016=4\times 504$ , the number of ‘3’s must be $504$ .

Hence, $m+M=504+504=\boxed{1008}$ .

The sequence $1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3,..., 1, 2, 1, 3$ satisfies all of above conditions.