# The Security to the Party [Part 9]

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 the host knows and trusts, whom he gave the password to enter to.

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

The first guest arrives. The security says "6", and the guest replies "6".

The second guest arrives. The security says "5", the guest replies "1".

The next guest arrives. The security says "10", the guest replies "2".

The next guest arrives. The security says "7", the guest replies "5".

The next guest arrives. The security says "8", the guest replies "4".

You walk up to security and get "3", what is the correct response?

• Where's the links for all the other parts? No credit? Without the other parts you wouldn't have a base for this question. – warspyking Nov 11 '14 at 13:57
• As someone posted on part 8, the party-security tag is serving as the list of puzzles now, no need for a massive link chain on every post. – Psychemaster Nov 11 '14 at 14:03

Putting these in a table makes a very simple possible pattern much more apparent, where the first column gives the questions, the middle column gives the known answers, and the last column is filled in based on the pattern:

1  |   || 5
2  |   || 4
3  |   || 3
4  |   || 2
5  | 1 || 1
6  | 6 || 6
7  | 5 || 5
8  | 4 || 4
9  |   || 3
10 | 2 || 2


As with all these questions, it may or may not be the answer you're looking for, but it works.

• Your last sentence hits it right on the head - It's right, but it's not how I got there. – Psychemaster Nov 11 '14 at 11:13

Given a as the input (what guard says) and b as output (keyword)

The next guest arrives. The security says "10", the guest replies "2".


a+b=12

a-b=8

12-8=4

The next guest arrives. The security says "8", the guest replies "4".


a+b=12

a-b=4

12-4=8

and so on, you get this table

a  b  (a+b)-(a-b)
10 2  4
9  ?  (6?)
8  4  8
7  5  10
6  6  12
5  1  2 (Sequence resets?)
4  ?  (4?)
3  ?  (6?)


Since we know a=3

so...

$$(a+b)-(a-b)=6$$ $$(3+b)-(3-b)=6$$ $$3-3+b+b=6$$ $$2b=6$$ $$b=3$$

So

You walk up to security and get "3", what is the correct response?

A : 3. (Steals spaghetti recipe)

$3$, since that's what I need to add to the guard's number to make it a multiple of $6$.

• Again, the answer is good, but the method doesn't match what I've used. – Psychemaster Nov 11 '14 at 11:15

The answer is 3. Find the highest multiple of 12 that is lower than or equal to the question. Subtract the multiple from the question. If the result is greater than 5 then you subtract it from 12, but if the result is 5 or less, then you subtract is from 6.

1. the highest multiple of 12 less than or equal to 3 is 0.
2. 3 - 0 = 3.
3. 3 is less than 5 so 6-3 = 3.
• That was my thought as well.. – Bolu Nov 11 '14 at 11:17
• As a curiosity, what answer would you give for, say, 22? – Psychemaster Nov 11 '14 at 11:18
• @Psychemaster, 2? – Bolu Nov 11 '14 at 11:21
• @Bolu Right, yet your logic in the answer would return -10. Perhaps you'd like to change it... – Psychemaster Nov 11 '14 at 11:22
• @Psychemaster I agree with Bolu it would start over after each multiple of 12. – levyian Nov 11 '14 at 11:23

Look up at the table:

10 - 2  =  8
[9]-[3] =  6 //my guess
8 - 4  =  4
7 - 5  =  2
6 - 6  =  0


As you can see, the difference goes down by every time 'til 0. If we follow this pattern we can go finding the matches for the remaining numbers.

 5 - 1  = 4
[4]-[2] = 2 //my guess
3 - 3  = 0
[2]-[0] = 2 //my guess
[1]-[1] = 0 //my guess


Obviously, 5 is less than 6, so the difference could be that high, thus 5-1 = 4. The same though has been made for 2-0 = 2.
Following this pattern, the solution is the well-known:

3

Here's the method I used where x is the number called out by the guard

(x mod 6) + 1, then take the number on the opposite side of a standard 6 sided die to the result.

Using this:

(3 mod 6) + 1 = 4, and 3 is the number on the opposite die face.

• Actually it's easy to prove that your method and the accepted method are equivalent. You do: $(x \mod 6) + 1$ then take the opposite side of the dice, this is $7 - (x \mod 6) + 1 = 6 (x \mod 6)$ – d'alar'cop Nov 18 '14 at 11:53

The answer is actually the opposite of what everyone has said...

-3.

While the other answers have provided solutions that fit the pattern, the spaghetti host is actually a big fan of...

tenth degree polynomials! For a value "x", the correct response is $p_0x^{10}+p_1x^{9}+p_2x^{8}+p_3x^{7}+p_4x^{6}+p_5x^{5}+p_6x^{4}+p_7x^{3}+p_8x^{2}+p_9x^{1}+p_{10}$ with values $p_i$ from the vector [ 3.30687831e-05, -1.28968254e-03, 1.95436508e-02, -1.35119048e-01, 2.63194445e-01, 2.05625000e+00, -1.47291997e+01, 3.86658730e+01, -4.55535714e+01, 1.84142857e+01, 1.66727566e-10].

Here's the full set of correct responses:

I'm not good at formatting, so I'll write them as (host, guest) ordered pairs. (0,0),(1,-1),(2,-2),(3,-3),(4,-4),(5,1),(6,6),(7,5),(8,4),(9,-9),(10,2).

Sorry if this counts as being a spoilsport, but linear algebra is fun!

• With enough effort, you could build an equation such that the answer required is the one you want, and all provided inputs fit into it. Sadly, you don't get to set that! – Psychemaster Nov 11 '14 at 16:46
• That's exactly what I did! What do you mean, "you don't get to set that!" My whole point is that the puzzle is not fully specified. If you provide n (host,guest) pairs in the puzzle without defining what types of methods the host could be using to generate the password, there will always be an n+1th degree polynomial that allows me to make up an answer for the n+1th query. Obviously this whole solution was a bit flippant, but the point is that there's not really anything in the puzzle that makes the other solutions more valid. – user3499545 Nov 11 '14 at 16:54
• Other than the fact you deliberately came to the completely wrong answer, that is. If you'd made an n+1 degree polynomial which specified 3 as the result, then I'd have at least given you credit for that. – Psychemaster Nov 11 '14 at 16:58
• I think you're missing my point though. Your puzzle was not sufficiently well-defined to only have one solution. There's nothing about the puzzle that makes mods legal but not polynomials, which means there's nothing about it that makes 3 right but -3 wrong. I'm claiming the puzzle is just about as invalid as if I had posted it, claiming as the author the solution was 923, then told you your solution for modular arithmetic and 3 was wrong because the answer was really 923. The puzzle itself should be sufficient to narrow things down to a solution without knowing a priori the author's solution. – user3499545 Nov 11 '14 at 17:00
• I fail to see the comparison. If the answer you give is wrong, then how you got to it is irrelevant - it's still wrong. It is the questioner who decides what the correct answer is, not the answerer. – Psychemaster Nov 11 '14 at 17:34