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.

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.

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).

• This is correct: I would phrase it as "Point the hour hand of an analog clock to the challenged hour (military time), then read off the first digit of the minutes at that position. IE. 18 hours is 6 hours, which points to 30 minutes; the first digit being 3 – Joe Nov 10 '14 at 19:55

I'll guess 3. Take a standard clock. Move from the 12 the number of hours the guard shouts. Note that you loop at the 12 which could be considered 0 or 12. When done, divide the final result by 2.

Zero.
The formula is 3*(challenge/6+(number of beggars)-3) or, equivalently, challenge/2+3*(number of beggars)-9. This fits all known good and bad responses, and allows each knight approaching to determine the answer independently: they don't need to know anything about who came before them.

My guess is "Minus nine". Answer = [guard's number] $\times$ ([number of beggars] - 1) / 2

• Hm, involving the number of beggars is interesting. That avoids the problem of having to know previous questions/answers. Your formula doesn't work out though. There are 3 beggars to begin with. – Martin Ender Nov 10 '14 at 18:02
• Nope :-) nice idea though – Joe Nov 10 '14 at 18:13
• This fails to predict 3/5 of the challenge/responses. Thanks for the idea, though. =) – Tim S. Nov 10 '14 at 18:51

Ten

Value of number - number of letters
'Six' --> 6 - 3 = 3 --> 'Three'
'Twelve' --> 12 - 6 = 6 --> 'Six'
'Eighteen' --> 18 - 8 = 10 --> 'Ten'

• Then the two twelves would be the same. – user4894 Nov 10 '14 at 19:03
• Might be that both are valid. A nice idea. – user1853181 Nov 10 '14 at 19:04
• Nice idea, but no – Joe Nov 10 '14 at 19:07

It's a guess, but does it have something to do with how the spies are dressed?

You specifically talk about the spies listening and not talking. Perhaps they are dressed as blind beggars? Then the problem isn't what they're hearing, but what they aren't seeing. My guess is that the soldiers are holding up a number of fingers when they call out their arbitrary number, based on the fact that none of the answers have been more than ten!

• I was thinking that there would have had to have been some kind of arbitrary information necessary such as number of soldiers or something similar... – Warlord 099 Nov 10 '14 at 17:28
• Well, at least something must be changing between instances since there are multiple correct responses to 'twelve' – Tom Hillman Nov 10 '14 at 17:34
• No, there's no hidden information – Joe Nov 10 '14 at 18:13

Six.
The knight has to respond the subtraction of the question by the guard with the previuos correct answer.
This has 2 minor flaws: you need to start with 3 and there is no way described as how the previous question is passed from knight to knight.

1. Start with Q: Six, A: Three (prev correct Q three FLAW HERE -> 6-3 = 3)
2. Q: Twelve, A: Six (prev correct Q six -> 12- 6 = 6)
3. Q: Eighteen, A: Nine (prev correct Q twelve -> 18-12 = 6 WRONG)
4. Q: Eighteen, A: Eight (prev correct Q twelve -> 18-12 = 6 WRONG)
5. Q: Twelve, A: Zero (prev correct Q twelve -> 12-12 = 0)
6. Q: Eighteen, A: Six (prev correct Q eighteen -> 18-12 = 6)

Something like a chalkboard must be available to all the living knights to sign their question for the future answerer.
My reasoning is simple: since 12 has two different answers there is no static way to get an answer, it depends from something dynamic. From the riddle, only two thing are dynamic between 12's answers:

- Change in the day

The change in the day can explain the 0, being the number of correct answers given that day. But this doesn't match with 18-9 the day before. Using the hour count doesn't help eiter, altough every number is minor than 24.
This leaves with the answers/questions being the only way to have dynamic data, but no strategy of close loop his shown, thus the flaw in my answer.

• No, each answer is independent – Joe Nov 10 '14 at 18:14
• @Joe Well, this leaves only one option – Narmer Nov 10 '14 at 18:17
• And that is...? :-) – Joe Nov 10 '14 at 18:17
• There is not enough room on the side of the page to write it all – Narmer Nov 10 '14 at 18:34

Two.
The answer is (number of letters in challenge modulo 6), where the answer must be in the range 0-6. "Six" has 3 letters, so the answer is "three". "Twelve" has 6 letters, so the answer is "zero" or "six". "Eighteen" has 8 letters, so the answer is (8-6=)"two".
This fits all known information: the good and bad responses, the dual answer to 12 (but no other used challenges), the independence of the answers, etc.

• Not correct - see Paul's answer, he's almost there – Joe Nov 10 '14 at 19:32
• Wouldn't modulo 6 be in the range of 0 through 5? With each input having one specific output? – Warlord 099 Nov 10 '14 at 19:34
• When working modulo 6, 0==6. You wouldn't normally use both BUT YOU COULD! sooo...yeah, you're basically right. – Tim S. Nov 10 '14 at 19:35

Answer is zero or twelve as it sits directly opposite the clock face of the number used as the question. I guess guard 2's answer could also have been Eighteen?

I think the solution here is

So in this case, the correct response should be 3.

• Then "nine" would have been correct on the first 18. – Martin Ender Nov 10 '14 at 17:49
• @MartinBüttner blast, you're right :( – wmarbut Nov 10 '14 at 17:51
• Not correct either :-) – Joe Nov 10 '14 at 18:15

It depends on the time of day. The numbers the guard gives are red herrings; the password is the hour of day, in military time.

• There's no hidden information, like the current time of day – Joe Nov 10 '14 at 18:14

I will say the answer is "Three!"

There is no indication whether it is the knight or the guard that yells either twelve. So the password is "Twelve!" if the knight yells first, or "Three!" if he is responding to the guard.

• It's always the guard challenging, sorry – Joe Nov 10 '14 at 19:10

Anything under six: for all successful answers, the challenge multiplied by the answer is less than one hundred. For all failed answers, the challenge multiplied by the answer is over one hundred.

• No. Far too big a range of possible answers, anyone might just guess their way in by chance :-) – Joe Nov 10 '14 at 19:13

Zero

Because on the second time twelve was said it was zero, so on the second time eighteen was said it would also be:

zero.

For the soldiers to tell which time it is (to confuse the spies) there's have to be a visual cue that the spies cannot overhear such as blinking.

• That would make for a horrible password system because then whoever was wanting to enter would have to have been around for all previous entries. – Warlord 099 Nov 10 '14 at 17:26
• Well combine it with @yamahito answer. They hold fingers to show what number it is. – warspyking Nov 10 '14 at 17:28
• Additionally, I believe that would be the third time that eighteen was yelled. – Warlord 099 Nov 10 '14 at 17:37
• @Warlord See the updated answer. – warspyking Nov 10 '14 at 17:51
• Not correct, answers don't depend on previous questions or answers – Joe Nov 10 '14 at 18:15