Maths Olympiad Prep

Track / Stage 6 / 18 of 400 #1018 of 1964

Problem 1018

National olympiad, first round
Combinatorics Difficulty 6.0 Prove it

Joe plays a game using some cards, each of which is red on one side and green on the other side. To begin the game, Joe selects integers kk and nn with 1k<n1 \leq k<n. He then lays nn cards on the table in a row with the red sides all facing up. On each turn, Joe flips over exactly kk of the nn cards. Joe wins the game if, after an integer number of turns,

| R | R | R | R | Start |
| :--- | :--- | :--- | :--- | :--- |
| R | G | G | G | After 1 turn |
| G | G | R | R | After 2 turns |
| R | R | R | G | After 3 turns |
| G | G | G | G | After 4 turns |

he has flipped the cards so that each card has its green side facing up. For example, when n=4n=4 and k=3k=3, Joe can win the game in 4 turns, as shown.

(a) When n=6n=6 and k=4k=4, show that Joe can win the game in 3 turns.

(b) When n=9n=9 and k=5k=5, show that Joe can win the game.

(c) Suppose that n=2017n=2017. Determine, with justification, all integers kk with 1k<20171 \leq k<2017 for which Joe cannot win the game.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Official solution

(a) The following table shows how Joe can win the game in three turns:

RRRRRR Start GGGGRR After 1 turn GRRRGR After 2 turns GGGGGG After 3 turns  \begin{array}{lllllll} \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \text { Start } \\ \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{R} & \mathrm{R} & \text { After } 1 \text { turn } \\ \mathrm{G} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{G} & \mathrm{R} & \text { After 2 turns } \\ \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \text { After } 3 \text { turns } \end{array}

On Joe's first turn, he turns over the first 4 cards.

On Joe's second turn, he turns over cards 2 through 5.

On Joe's third turn, he turns over the four red cards.
(b) There are many sequences of moves in which Joe can win.

Suppose that Joe takes 9 turns. On turn 1, he turns over cards 1, 2, 3, 4, 5. On turn 2, he turns over cards 2,3,4,5,62,3,4,5,6.

He continues in this way so that, on each turn, he turns over five consecutive cards starting with the tt th card on turn tt, with the understanding that card 1 comes after card 9 . This means, for example, that on turn 7, Joe turns over cards 7,8,9,1,27,8,9,1,2.

In this way, each of the 9 cards is turned over 5 times (once as each of the 1st, 2nd, 3rd, 4 th, 5 th card in the sequence).

Since each card is turned over an odd number of times, its final colour is the opposite of the starting colour, and so it is green.

We demonstrate this in the following chart:

| R | R | R | R | R | R | R | R | R | Start |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| G | G | G | G | G | R | R | R | R | After 1 turn |
| G | R | R | R | R | G | R | R | R | After 2 turns |
| G | R | G | G | G | R | G | R | R | After 3 turns |
| G | R | G | R | R | G | R | G | R | After 4 turns |
| G | R | G | R | G | R | G | R | G | After 5 turns |
| R | R | G | R | G | G | R | G | R | After 6 turns |
| G | G | G | R | G | G | G | R | G | After 7 turns |
| R | R | R | R | G | G | G | G | R | After 8 turns |
| G | G | G | G | G | G | G | G | G | After 9 turns |

Joe can actually finish in as few as three turns:

RRRRRRRRR Start GGGGGRRRR After 1 turn GGRRRGGRR After 2 turns GGGGGGGGG After 3 turns  \begin{array}{llllllllll} \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \text { Start } \\ \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \text { After } 1 \text { turn } \\ \mathrm{G} & \mathrm{G} & \mathrm{R} & \mathrm{R} & \mathrm{R} & \mathrm{G} & \mathrm{G} & \mathrm{R} & \mathrm{R} & \text { After } 2 \text { turns } \\ \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \mathrm{G} & \text { After } 3 \text { turns } \end{array}

(c) Suppose that n=2017n=2017. This means that Joe has 2017 cards.

We show that Joe can win the game when kk is odd and cannot win the game when kk is even.

Suppose that kk is odd.

Suppose that Joe takes 2017 turns.

For each t=1,2,3,,2016,2017t=1,2,3, \ldots, 2016,2017, Joe turns over the kk cards starting at card tt, and with the understanding that card 1 comes after card 2017.

In this way, each of the 2017 cards is turned over kk times, once for each "position" in a sequence of kk consecutive cards.

Since kk is odd, then the colour of each of the 2017 cards is reversed at the end, and so each is green.

In this way, Joe wins the game when kk is odd.

Suppose that kk is even.

For Joe to win the game, each of the 2017 cards must be turned over an odd number of times in order to reverse its colour.

This means that the total number of card flips is odd, since this total is the sum of 2017 odd integers (the number of flips for each of the 2017 cards).

For any positive integer tt, after tt turns, Joe has flipped a total of tkt k cards ( kk on each of tt turns).

Since kk is even, then tkt k is even.

Therefore, after any number of turns, the total number of card flips is always even and so cannot be the odd number of flips necessary to reverse the colour of all of the cards.

Therefore, when kk is even, Joe cannot win the game.

In summary, when n=2017n=2017, Joe can win the game for all odd kk with 1k<20171 \leq k<2017 and cannot win the game for all even kk with 1k<20171 \leq k<2017.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.