# 1 in, 1 out (The Security to the Party Maze)

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 spaghetti recipe is kept in a secret room inside the mansion, which is only accessible from the kitchen, which can be only reached from the party lounge, which is separated from the security lobby by a floor where elephants have been reported to occasionally trample fishy guests.

The mansion has two entrances to the security lobby, and all adjacent rooms are connected by two doors.

Your task is to enter the mansion, sneak into the secret room, steal the spaghetti recipe and get out again. Here is a plan of the mansion.

In this puzzle, you start as the number 1 outside the mansion and each time you pass a door, an operation indicated on the door will change your number. After leaving the mansion with the recipe, you must be again number 1 as when you came in.

You can pass all doors multiple times in both directions, but the less, the better, otherwise the security may become suspicious and you don't want them to release the elephants :) The shortest solution wins.

• What happens at root(5) or 3/2? – Mohit Jain Nov 14 '14 at 8:31
• root 5? There's no root five in this puzzle nor you can get one. It multiple by root two. 5 times root 2 is 5 root(2)? CMIIW. – Realdeo Nov 14 '14 at 8:33
• And what about 3/2? Is it 1.5? – Mohit Jain Nov 14 '14 at 8:33
• @Realdeo Yes, there's no rounding :) – GOTO 0 Nov 14 '14 at 8:34
• +1 for a Security to the Party puzzle that is concrete enough that there is a provably correct solution. – Kevin Nov 14 '14 at 18:54

12 doors. Total number of steps must be even. And problem can not be solved in 10 doors or fewer.

Step 1 : 1 + 11 = 12 Security
Step 2 : - 7 = 5 Elephant
Step 3 : + 4 = 9 Party
Step 4 : - 1 = 8 Kitchen
Step 5 : - 6 = 2 Secret
Step 6 : - 6 = -4 Kitchen
Step 7 : - 1 = -5 Party
Step 8 : * √2 = -5√2 Kitchen
Step 9 : * √2 = -10 Party
Step 10: / 2 = -5 Elephant
Step 11: * 2 = -10 Security
Step 12: + 11 = 1

• That was quick, congrats! You're the spaghetti man ;) – GOTO 0 Nov 14 '14 at 9:24

1 + 11 * 2 / 2 - 1 - 6 - 6 - 1 - 1 - 1 - 1 - 1 / 2 - 7 + 11 = 1
14 doors, but sort of achieved with a quick and dirty program and some thinking (that also proved that there is no 10-door-possibility, so Jan's answer is the optimum.)
http://pastebin.com/VraSrJ9R contains a neat little list of all 1024 "10-door-possibilities", 0 being the left option, 1 being the right option.

Another 12-door-solution I like a lot:

1 + 11 - 7 + 4 - 1 - 6 - 6 - 1 - 1 - 1 + 4 - 7 + 11 = 1
Essentially only take addition/substraction and go through the -1 door twice (three times, you know what I mean).

If we are not allowed to temporarily exit and re-enter the lobby, then there are

28 distinct shortest (12 step) solutions,

illustrated in this diagram:

The diagram was created with the assistance of a computer program.

Each column represents a distinct combination of room, whether we have the recipe, and whether we have backtracked once yet. Every step moves from left to right by either one column or two. The gray boxes contain the number at that point in the path, where R = √2. Red lines correspond to going through the left door and green lines correspond to going right. Thick lines denote backtracking.

The purple boxes indicate the number of paths from that point forward for some points, usually near choice points. (There is some inconsistency in their placement for diagram layout reasons.)

If we are allowed to temporarily exit and re-enter the lobby (just after starting or just before finishing) despite the number not being 1, then

there are even more 12 step solutions; I have not tried to count them all.

One example path that leaves the lobby near the start is:

1, 12, 4 (here we are outside), 15, 30, 34, 33, 27, 21, 20, 10, 3, 1.

One example path that leaves the lobby near the end is:

1, 12, 5, 9, 8, 2, -4, -5, -1, -2, 9 (here we are outside), 3, 1.