Wednesday, 8 May 2013

What's the Password, again?


War has broken out in the kingdom. The king's castle is guarded pretty heavily, by guards with instructions to kill anyone who can't produce the correct password.


Unbeknownst to the guards, the beggars near the main gate are in fact enemy spies. They listen intently as the first knight approaches. "Six!", the guard calls out. "Three," answers the knight. He is allowed through. "Aha," the spies think.


But they needs to be sure. They see another knight approaching and listen in on his exchange with the guard. "Twelve!", "Six!"


One spy decides he's heard enough, so he leaves and returns dressed as a knight. "Eighteen!" The spy answers "nine" and is killed on the spot by the guards.


Another spy, who used to browse Puzzling.SE before he signed up for the Espionage Division feels a moment of deja vu, and decides he now knows the answer. As night falls, he goes off and disguises himself as a knight. He comes back in the morning and walks up to the guard.


"Eighteen!" shouts the guard, "Eight!" the spy replies. The guard cuts him down, and he makes a surprised "gurgle...splot" noise as he dies.


The last spy, still in hiding is confused. As he's thinking, another knights walks up. "Twelve!" is the challenge, "Zero!" comes the reply. The guard steps aside and the knight enters.


Finally, the last spy gets up, goes off and does the whole dress-as-a-knight thing and comes back. "Eighteen!" shouts the guard. What is the correct response?



Update: The answer to TWELVE could have been Zero or Six either time - both were correct. This is one of only two such cases of 2 valid answers.


Edit for anyone who sees this in the future: I'm aware that it's not fully-scoped. It's my first puzzle and I neglected to give any odd-number examples, which is kind of important. It's totally solvable without them, I just should have included at least one.



Answer



After reading Paul's answer:



Start with an analog clock at noon (or midnight). The number the guard starts with is the number of printed digits to advance the minute hand (in other words, the number of 5-minute intervals to advance the time). Take the number of minutes past the hours and divide by 10. That's the answer the knight gives.



This yields an answer of:



three




Expressed as a math formula, where N is the number the guard gives, the solution is:



(N % 12)*5 / 10 (more or less - modulo doesn't actually give the answer x for x%x, but humans who don't understand how modulo works sometimes do).



No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...