## Task 16/63

The following "card trick" is to be mathematically justified:

A player is asked to draw a card from a deck of 32 cards and place it face down. Let's assume, for example (without regard to the suit), that this is a Seven.

The player then places additional cards on the drawn one, counting from the value of the drawn card up to 11 (in this example, "eight, nine, ten, eleven"). This creates a pile of cards. The procedure is continued with more piles until a remainder of cards remains that does not form a complete pile (if an Ace is drawn, it forms a pile by itself).

From the number of piles and the number of cards in the remainder, one can determine, without having watched the formation of the piles, the sum of the values of the drawn cards.

Provide the calculation.
Let the sum of the eyes on the drawn cards be $x$, the number of piles be $n$, and the number of cards in the remainder be $r$. Then, for the number $A$ of cards in the piles,

$$
A=n+11 n-x=12 n-x
$$

But $A+r=32$ so $12 n-x+r=32$. From this, it follows that $x=12 n+r-32$.

The procedure can be varied by counting beyond 11 to a larger number, or by using a deck that does not consist of 32 cards.