Júlia has a deck of 18 cards, numbered from 1 to 18. After shuffling, she distributes the cards with the numbers facing down, in 3 rows and 6 columns, as shown in the figure.
![](https://cdn.mathpix.com/cropped/2024_05_01_3fc4f3a6ef7302a792fcg-02.jpg?height=514&width=780&top_left_y=1564&top_left_x=519)

Júlia chooses a sum $X$ and flips two cards. If the sum is $X$, she removes the pair from the table, but if it is not $X$, she returns the cards to their initial position. She repeats this process until all pairs with a sum equal to $X$ are flipped.

a) If she chooses $X=8$, which pairs will be removed from the table?

b) For which value of $X$ will all the cards be removed from the table?
c) For a certain $X$, exactly 2 cards remain on the table. How many possible values of $X$ are there?
Solution

a) Since $1+7=8,2+6=8,3+5=8$, the pairs will be $(1,7),(2,6)$ and $(3,5)$.

b) If $X>19$, the card 1 will not be able to form a pair with anyone. If $X>21$, more than two cards will remain;
4) if $X=18$, the cards 9 and 18 remain;
5) if $X=17$, the cards 17 and 18 remain;
6) if $X<17$ more than two cards remain.

Therefore, there are 4 values of $X$ that result in exactly 2 cards remaining on the table: 17, 18, 20, and 21.