4
$\begingroup$

A party is being held at a local mansion. The host is very rich and his success is because of one thing — his famous recipe for Spaghetti!

The only guests that may attend are people who correctly reply to the guard at the door.

Here's where you come in. You and a friend are trying to steal this recipe. You sneak by and listen to the passwords.

However, when the first guest arrives, you are dismayed to find that the guard does not ask them a question, but merely motions for them to stand by the gate. When the second guest arrives, the guard motions to them too, and they line up behind the first guest. This goes on until at last there are 19 guests lined up.

The guard looks at his watch and says, "Well, I think everyone is here, but we will wait a couple of minutes just in case there are any stragglers." At this you and your friend realize that this is your last chance so you quickly come out and line up at the end.

"As you know," says the guard. "There have been many attempts made to steal our host's secret recipe, and at every party somebody has managed to learn the password scheme and sneak in when they shouldn't." The guards eyes each of the guests one by one, as if to divine any unauthorized guests presently in attendance, but when his eyes meet yours you stare right back at him dumbly.

"So our host has gone back and picked a variant on one of his earlier schemes that his thinks perhaps nobody outside our group quite caught on to and mixed it up a bit. And just to wise up a little, as you know, you are all standing here together before I will start asking the questions, so as to not leak any information. Is everybody ready for me to give out the number?"

You and your friend see everyone else nodding, so you nod too, fearful of what is going to come next.

The guard pulls out his clipboard and then counts all the potential guests. "I see 21 people," he begins, and scanning down his clipboard he quickly calls out, "The challenge is thirteen thousand eight hundred and thirty two. We will start at the head of the line and work backwards."

"5" says the first guest after a few moments, and he is let in. "12" says the second guest. The guard nods and lets him by. "16". "Yes." "17" "Sure". "14" says the fifth guest. "Your answer is baseless!" exclaims the guard and a out of nowhere a large gorilla zip-lines across the group and snatches up the fifth guest and carries him off. "The correct answer was 40!" the guard says loudly, then smiles at the sixth guest. "No reason for you to have to figure out two answers, eh?" The sixth guest nods, then says "65". "Correct."

The remaining guests in front of you all answer correctly. Starting with the 7th guest, the answers are: 72,58,38,31,32,37,44,29,56,27,52,11, and 22.

Before it gets to your friend, who is in front of you, he turns and whispers to you, "Well it's pretty obvious this isn't just a random sequence, isn't it? If there had been one more person, he would have had the same number as me!" but then it is his turn and he has to turn and quickly answer: "35".

The guard eyes him over for a minute, then replies, "Correct."

Now it is your turn! What number do you tell the guard?

Anti-Hint:

If there were only 4 guests, the guard would have been in a pickle! He would have had to challenge with "14" and the correct responses from each guest in order would have been "3", "4", "5" and "6". Fortunately the host knew that at least 6 people would show up ("27" -> "4", "6", "7", "9", 3", "1").

Hint:

The guard must base his challenge on the number of guests that show up at the door. Your friend figures out why before he gives his response.

$\endgroup$
  • $\begingroup$ Challenge: 30832, a number that depends somehow on the fact that there are 21 guests. Numbers: [5, 12, 16, 17, 40, 65, 72, 58, 38, 31, 32, 37, 44, 29, 56, 27, 52, 11, 22, 35, ???]. It is pretty clear that it does not depend on timing or in looking who or what the guests are. The sequence appears to be random, but it looks biased, so I don't think that it distributes uniformly, but I might be wrong. Further, why the guy that should answer 40 got it wrong? Is it relevant the fact that the animal is a gorilla and not something else? There should be some similarity with part 20 too. Thinking... $\endgroup$ – Victor Stafusa Nov 14 '14 at 12:31
  • $\begingroup$ 30832 = 2^4 * 41 * 47. I think that having two relatively large primes in its factorization might be important. $\endgroup$ – Victor Stafusa Nov 14 '14 at 13:07
  • $\begingroup$ @Victor The gorilla is unimportant (just mixing it up) but what the guard says after the Gorilla goes by is an important clue. Also, now that the second half of part 20 has been mostly cracked, the other piece should be easiest to figure out. $\endgroup$ – Michael Nov 14 '14 at 15:33
  • $\begingroup$ "No reason for you to have to figure it out two answers, eh?" - Hmm... $\endgroup$ – Victor Stafusa Nov 14 '14 at 15:35
  • 1
    $\begingroup$ @Victor also, the challenge number is not 30832... $\endgroup$ – Michael Nov 14 '14 at 15:38
5
$\begingroup$

Inductive definition of the nth guest's answer $A_n$:

$A_1$ is

the sum of the digits of the binary representation

of the number given by the guard. $A_n$ is

the sum of the digits of the base-$A_{n-1}$ representation

of the number given by the guard.

So you should say

28, since the base-35 representation of 13832 is BA7 and 11+10+7=28.

$\endgroup$
  • $\begingroup$ Yes, that's basically it. The guard has a list of the challenge number to give for each number of guests. Although actually it goes something like this: 4,6,8,10,13,14,17,19,20,21,... so the guard may have to round up the guest count to the nearest number. $\endgroup$ – Michael Nov 14 '14 at 16:00
  • $\begingroup$ Although, just a clarification, although each guest must technically use the previous answer as a basis for their own, it often works out that they don't have to. The host got too clever and didn't realize this. $\endgroup$ – Michael Nov 14 '14 at 16:01
  • $\begingroup$ @Michael - I don't feel right about letting you accept my answer, since I still don't understand the algorithm! Where do the 3rd to 20th answers come from, and what is the correct 21st answer? I'm still working on it! $\endgroup$ – Rand al'Thor Nov 14 '14 at 16:04
  • $\begingroup$ Ok, I'll withdraw the accept until you finish figuring it out. Although you didn't really state it clearly, it seemed as though you had figured it out. With regard to 6 guests, look at the numbers you give versus the answers... my comment was, sometimes the same sum comes up in more than one place, which is why I think the 5 is out of place. $\endgroup$ – Michael Nov 14 '14 at 16:19
  • $\begingroup$ @Michael - got it! :-) $\endgroup$ – Rand al'Thor Nov 14 '14 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.