A king has 100 identical servants, each with a different rank between 1 and 100. At the end of each day, each servant comes into the king's quarters, one-by-one, in a random order, and announces his rank to let the king know that he is done working for the day. For example, servant 14 comes in and says "Servant 14, reporting in."
One day, the king's aide comes in and tells the king that one of the servants is missing, though he isn't sure which one.
Before the other servants begin reporting in for the night, the king asks for a piece of paper to write on to help him figure out which servant is missing. Unfortunately, all that's available is a very small piece that can only hold one number at a time. The king is free to erase what he writes and write something new as many times as he likes, but he can only have one number written down at a time.
The king's memory is bad and he won't be able to remember all the exact numbers as the servants report in, so he must use the paper to help him.
How can he use the paper such that once the final servant has reported in, he'll know exactly which servant is missing?
When the first servant comes in, the king should write down his number. For each other servant that reports in, the king should add that servant's number to the current number written on the paper, and then write this new number on the paper.
Once the final servant has reported in, the number on the paper should equal
(1 + 2 + 3 + ... + 99 + 100) - MissingServantsNumber
Since (1 + 2 + 3 + ... + 99 + 100) = 5050, we can rephrase this to say that the number on the paper should equal
5050 - MissingServantsNumber
So to figure out the missing servant's number, the king simply needs to subtract the number written on his paper from 5050:
MissingServantsNumber = 5050 - NumberWrittenOnThePaper
Two Japanese people who have never seen each other meet at the New York Japanese Embassy. They decide to have drinks together at a nearby bar. One of them is the father of the other one's son. How is this possible?
The Japanese are husband and wife and both blind since birth.
Suppose you want to send in the mail a valuable object to a friend. You have a box which is big enough to hold the object. The box has a locking ring which is large enough to have a lock attached and you have several locks with keys. However, your friend does not have the key to any lock that you have. You cannot send the key in an unlocked box since it may be stolen or copied. How do you send the valuable object, locked, to your friend - so it may be opened by your friend?
Send the box with valuable object and a lock attached and locked. Your friend attaches his or her own lock and sends the box back to you. You remove your lock and send it back to your friend. Your friend may then remove the lock she or he put on and open the box.
Search: Man-in-the-middle attack