Problem #PRU-116064

Problems Mathematical logic

Problem

The dragon locked six dwarves in the cave and said, "I have seven caps of the seven colors of the rainbow. Tomorrow morning I will blindfold you and put a cap on each of you, and hide one cap. Then I’ll take off the blindfolds, and you can see the caps on the heads of others, but not your own and I won’t let you talk any more. After that, everyone will secretly tell me the color of the hidden cap. If at least three of you guess right, I’ll let you all go. If less than three guess correctly, I’ll eat you all for lunch." How can dwarves agree in advance to act in order to be saved?