Two spies want to get in an enemy’s military base. In order to get in they have to give the correct countersign to the guard at the gate after he gives them the sign. So, they wait hidden nearby the gate so that they will overhear the countersign from another soldier. One soldier comes and the guard gives the sign: “6”. The soldier answers “3”. The guard lets him pass. Another soldier comes. The guard says “12” and the soldier gives the answer “6”. The guard lets him pass. So, the first spy goes at the gate and the guard says “10”.The spy, sure that he knew the answer as he was, says “5”. Immediately, the guard shoots him dead. Then the other spy, who saw that the other spy was killed when he gave the countersign, had now understood what the right answer would be, whatever the guard’s sign was.So, he walks to the gate and the guard says “8”.The spy gives the correct answer and the guard lets him in. What was the answer that the spy gave?
see the answer in the comments.