Subscribe via feed.

My Name is Bond, James…..

Posted by Karl Sharman on October 7, 2010 – 6:19 am

As is typical in your line of work, you find yourself trapped in a room with only one possibility of escape. On this occasion, Doctor No leaves you a puzzle to solve.

You wake up in a room with a single door, which you observe is the only way out of the room. On the door are 10 dials, which can be turned so that the digits 0-9 can appear. There is also a small red button. Next to the door is a wooden table with a computer. The computer interface only has 10 buttons, one for each digit. The screen has two rows of 10 squares.

On the wall, you see a note: “Since you are reading this, you must be awake. I could have just killed you, but the scriptwriters would never allow this, so they thought you should be given some chance to escape. The room you are in is equipped with exactly two means of killing you. One is some poison gas vents. The other is the floor, which can open, causing you to fall into a pit of alligators, poisonous snakes, and whatever other deadly things my trainee henchman has brought in.

When you select a code on the door and press the little red button, the door will open in 10 minutes. However, first one of the two traps will probably go off. Shame I couldn’t use both, really, but it wouldn’t do to kill off all my lovely pets.

You may have noticed the computer in the room. This is a special computer that works on a certain rule. You can enter a 10 digit number, and based on the rule, the computer will output a new 10 digit number. The door mechanism is related to the computer. For any given 10 digit number, x, and its output, y, if setting the dials on the door to x opens the floor, then setting them to y will cause the poison to flood the room. And, conversely, if x brings poison the room, y will open the floor.

Good luck, old bean.
Doctor No”

You go back to the computer for a second look, and try a few random numbers. When you input 9630751442, you get 1111211101. When you input 6626012798, you get 1120003111. When you input 3578545411, you get 0201230110. When you input 4720309962, you get 2021101102. You obviously don’t want to try to survive 10 minutes in a poisoned room, or in a pit of deadly animals.

But how can you get out?

This post is under “Tom” and has 25 respond so far.
If you enjoy this article, make sure you subscribe to my RSS Feed.

25 Responds so far- Add one»

  1. 1. Nathan Said:

    Use Q’s laser watch to cut the lock.

  2. 2. Anonymous Said:

    well from the x’s and y’s we’ve been given, one can see that the y values are simply counting the appearance of the digits in x:
    9630751442 gives 1111211101

    0-1 of them
    1-1 of them
    2-1 of them
    3-1 of them
    4-2 of them
    5-1 of them
    6-1 of them
    7-1 of them
    8-0 of them
    9-1 of them

    since there are only 10 digits y should add up to 10. But since the digit can only go from 0 to 9, if we plug a value in 10 times, presumably there can be no y. However 111111111 could be a valid y for 9876543210 presumably. So if I plug in a number like 2222222222 then y can not exist. So conversely this should not be an x.

    From this reasoning 10-0s,3s,4s,5s,6s,7s,8s,9s should be good

    At least that’s my first stab at it


  3. 3. slavy Said:

    I agree with Cam about the strategy of the computer :) The problem is not completely clear to me, but based on my puzzle experience, I assume that “the code” is the unique input which coincides with its output and this is the combination we need in order to open the door? If so – just find this magic number ;)

  4. 4. Nathan Said:

    That is an interesting point, but since x produces y and y produces x according to the description, then 1111211101 would yield 0000000181 instead of 9630751442 like we should expect.

  5. 5. Spencer Said:

    Open the door and walk out. Nobody said that the door is locked, did they?

  6. 6. BMJ Said:

    I came here cause I didn’t even know how to solve this riddle. then I saw spencer’s post. and I immediately went ‘duh’. it DOESN’T say anything about the door being locked. its so obvious that its overlooked. haha!

  7. 7. slavy Said:

    @Nathan nowhere in the statement the word “one-to-one” is used! So, if x is an input and y – an output then we now that one of them brings one of the disasters, while the second one – the other. So we can have a chain x-y-z-… (z is the output of y, etc.) and we just assign one disaster to the first element in the chain and the rest will alternate. The problem is: what if there is a cyclic chain of odd elements? In this case we cannot assign anything to any element in it, because after the cycle it should be responsible for the other damage, as well (and this is explicitly forbidden in the text). Therefore such codes are harmless (note that in the text we have two if clauses and their interpretation is that only SOME not ALL of the combinations are dangerous) and we can use any of them to (100%) safely open the door. I don’t know how many such cycles exist but I am sure that there is a unique one of length one (i.e., x-x-x-x-x…) which will help. However, the solution may not be unique!

  8. 8. Anonymous Said:

    RE: Nathan’s point.

    1111211101 would yield 0000000181 instead of 9630751442

    From my reading of the problem (not to say that it is correct by any scope of the imagination), Bond was plugging in only x values which yielded unique y values.

    So I was thinking there must be a many x to one unique y relationship, as any x that is a permutation of 9630751442 should still yield a y of 1111211101. But if we enter in any number whose digits sum to 10, it must be reserved for y, as a combo can’t open the pit and release gas at the same time. Thus, I think the computer must recognize this type of number as a y and spew out out one of the many permutations of x. Of course, this is all speculation without an example, which we don’t have.


  9. 9. Chris Said:


    7200000100 =>
    7110000000 =>
    7200000100 etc., if that’s any help!

  10. 10. Chris Said:

    …OOOPS, that’s wrong. Back to the drawing board.

  11. 11. Chris Said:

    For fun 62100 01000 => 62100 01000, but need a pair.

  12. 12. wamatt Said:

    if we asume that both trap can not go off at oncs

    we need x and y to be the same answer

    there fore if we put in 0000000000 the answer would come out 0000000000 ( as 10 “0″ would come out as a 0 )

    put the code in to the door and wait 10 minutes and walk out

  13. 13. slavy Said:

    By the way – there are many save codes (maybe even more than the half of them!) Indeed, take any input x which gives rise to the magic output 6210001000, proposed by Chris. Since we have that the output is save, so should be the input (otherwise we get logical contradiction with the if clauses). As discussed by Nathan and Cam – there are many inputs leading to the same output! For example one of them is 6120010000. But it is easy to check that it is a possible output as well (6*0+1*1+2*2+1*5=10). Hence, all the inputs that correspond to it are save, as well. In particular – 5220100000, which is again a legitimate output and so on… We can build many brunches of save combinations. However, if you have to save your life you will not find the problem that amusing and instead of digging deeper into it you will most probably just dial 6210001000 and be free…

  14. 14. Chris Said:

    I’m not sure that that’s what Karl wants though. I suspect that we want a pair that produce each other. But which is life and which is death???????

    slavy, was this another example of the fixed point theorem?

  15. 15. slavy Said:

    A pair that produces each other is not good for our life, because this is a cycle of even order (in this case – 2) so one can just set 7200000100 to activate the gas, while 7110000000 to open the floor. Actually this is a nice example, that not all the combinations can be harmless, because there is no path/chain that links those numbers to 6210001000. Again, as before, it follows that all the combinations that taken as input eventually lead to those two as output (maybe after many iterations) can kill you. This is why I meant that at about 50% of the combinations seem to be harmless (even though this is not a precise mathematical statement and there is lots of work to verify/deny the conjecture)!

    And, no :) this is not connected to the fixed point theorem, because we don’t have continuous objects. This is algebra and if we manage to assign some nice group structure to the combinations we can use the tools from this lovely field. However, I doubt it, since 2222222222 for example can neither be an input nor an output…

  16. 16. Chris Said:

    Credit to Cam for spotting the basic rule. I hadn’t seen it myself.

  17. 17. Mysterious Said:

    it seems that everyone has been looking for some special code that would open the door without trigerring a trap, however it says that if a number is entered it must trigger either of the traps. so instead of fighting over which code to chose think of how you would survive. firstly if you trigger the poisonous gas, you can live through it by urinating on a cloth (clothing will sufice) and covering your mout with it which would slightly neutralise the poison gas. although this ma seem disgusting but it was actually used in the second world war. if the hungry animals trap is activated youd have to hope that the animals ate each other and are full enough not to need to eat you. or maybe they werent put in as it was amateurs who put it in.

    Anyway if u survive either then the door will open and ur free

  18. 18. Eketahuna Said:

    (…596, 597, 598, 599, 600, 601 !) Phew !!!
    Right, I’ve been practicing and can now hold my breath for just over 10 minutes so I’m going to have to assume there is some sort of handhold that can support my undisclosed weight and have a go with using Chris’ 62100 01000.
    Here’s my reasoning … well there isn’t any really, I’m just assuming that for an input of x and an output of y, one of the pair will release the gas, the other the floor. As we can’t release BOTH, and with 62100 01000 (or one of the other possibilites ?) the x and y are the same, so neither will be released, just the door opening.
    Now to practice hold my breath for 10 minutes and hanging from something at the same time …

  19. 19. Karl Sharman Said:

    There are three things that you need to realize to solve this puzzle (and one thing that may imply that JB is stuck in the room without such an easy escape route as an unlocked door – that’s the word “trapped”;-))

    1. The computer works in a rather simple way. Each digit of the output represents the number of times that a digit occurs in the input. The first place gives the number of “0″s, the next gives the number of “1″s, etc. Well spotted Cam.

    2. You are told that both means of your death can not happen. You are also told that given an input x and its output y, x=poison implies y=pit, and vice versa. So how can you get out alive? You need a number that returns *itself*.

    3. What is this number? Here is a solution:

    We need a 10 digit number such that the first digit is the number of “zero’s” in the number. Obviously we can only have 1 of the digits five, six, seven, eight and nine or the digits would add up to more than 10 (the total number of digits must equal the sum of the digits – spotted by Cam – again!). That means we have at least 4 of the number zero. Let’s call the number of zeros we have x.

    So our number is: x????–1–
    The notation at the end means there is at most 1 of the last 5 digits. Since there is a 1, we must put a 1 in the ones place: x1???–1–
    But wait, there’s now 2 ones… so, let’s put a 2 in the ones place and a 1 in the twos place: x21??–1–
    By this logic, as we know the beginning x will be a 4 or more we can’t have any threes or fours, so we’ll fill those in with zeros: x2100–1–
    Now we know that x is 6, so to finish it off: 6210001000

    So, 6210001000 is our solution. Are there any other solutions? Yes. If we can find a number that gives our solution as its output, it must also work, because if it sets off a trap, our solution would have to set off a trap, and two traps won’t work together. So, any number with 6 zeros, 2 ones, 1 two, and 1 six will work. Also any number that will produce any of those numbers will work, and so on.

    James “Chris” Bond seems to be our master-spy in the making. Well done.

  20. 20. Chris Said:

    To avoid risk of unintended plagiarism, I acknowledge that I had seen slavy’s comment about a number that codes to itself.

    I’ve been waiting for slavy to ask what is the set of numbers that reduce to the code. Obviously any anagram of it does. But are there other numbers?

    I’ve just found (whilst writing this) that
    63000 00100 => 71010 01000 => 63000 00100 etc.

  21. 21. slavy Said:

    What I am interested in here is if there are any cycles of higher order, for example 3, or can it be proven that this is impossible. So, if someone finds an example or an argument for a cycle x-y-z-x, please let me know :)

  22. 22. Chris Said:

    Hi slavy. I knew you hadn’t put this one to bed. It’s too interesting.

  23. 23. slavy Said:

    OK, the brute force appeared to be not that brutal :) As we know there is only one cycle of order 1 (6210001000), but it can be shown that there is only one cycle of order 2, as well (Chris’ example from post 20 – his first example is wrong, because 7200000100 => 7110000100) and that’s all! No more cycles! Moreover, if I haven’t made some of my usual arithmetic mistakes, 31757040 of all the 10^10 combinations lead to 6210001000, which is 0.3175 % of all the codes…

  24. 24. Annie Said:

    just open the door

  25. 25. Alanis Said:

    You should just chill out there till Doctor No comes back to check on you then RUN!!

Post a reply

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\ext\php_mssql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\ext\php_pdo_mssql.dll' - The specified module could not be found. in Unknown on line 0