Mathematician's Card Trick
I apologize for not posting in a while; my health has not been great.
The origin of today’s puzzle can be traced back to a Math Olympiad question in 2000.
The Setup
A mathematician has 100 cards, labeled 1-100. Using strategy, he distributes these cards into three boxes so that there is at least one card in each box.

Turning his back, he invites a friend to secretly select two of the boxes and withdraw a single card, at random, from each of the selected boxes. The mathematician then asks the friend to add the numbers on these cards and announce the sum. Immediately, the mathematician is able to identify the box that did not have a card taken from it.
How did the mathematician distribute the cards, and what method did he use to solve the problem?
How did the mathematician distribute the cards?
Solution
There are two possible distribution/calculation strategies that I am aware of (I you can think of others, please let me know).

Advertisement:
Solution 1
This is, probably, the easiest solution to understand. Without loss of generality:
- The mathematician places card 1 in box #1.
- He places card 100 in box #2.
- He places cards 2-99 in box #3.
This follows the requirement that there is at least one card in each box.
- If the sum of the two cards is 101, then the friend select boxes #1 and #2.
- If the sum is greater than 101, then the friend selected boxes #2 and #3.
- If the sum is less than 101, he selected boxes #1 and #3.

Solution 2
The second solution relies of modulo three arithmetic. The modulus of a number is the remainder after division occurs.
- The mathematician places in box #1 all the cards with remainder zero after division by three. e.g. 3, 6, 9, 12, 15 …
- He places in box #2 all the cards with remainder one after division by three. e.g. 1, 4, 7, 10, 13 …
- He places in box #3 all the cards with remainder two after division by three. e.g. 2, 5, 8, 11, 14 …
After the sum is announced, the modulus of the sum describes which box has not been touched. If the remainder is zero, then the first box was not picked from. If the remainder is one, then the third box was not picked from. If the remainder is two, then the second box was not picked from.
Modulus arithmetic ‘wraps around’ to ensure this strategy always works. Any card selected from the first box has modulus zero. Any card selected from the second box has modulus one. Any card selected from the third box is modulus two.
I like this solution as is can be generalized to any set up numbered cards, not just a specified range.
