Assume you have an unlimited but finite number of linking, teleporting doors you can add to a hallway of finite length. Assuming there's a door at the start and finish, can you arrange the teleports so that one can never make it to the end of the hallway?

For example:


Where when you enter A from the left (you'll never turn and enter from the right) you come out of the other A on the right. So you'd enter the first A, come out of the second, enter B come out of the other, hit A again, and when you exit the other and hit B you've got to the end.

You HAVE to start before the first door, and every tele door HAS to have a linking door. No combining links (AB would not have a 50 - 50 chance of A or B) and no more than 2 links, so no random linking.

Can you arrange the tele doors in such a way, you'll never reach the end? If so, how many tele doors does it require, and what's the setup? If not, prove it's impossible.

  • 1
    $\begingroup$ Yeah, I thought that the given example caused an infinite loop, but looking at it again it doesn't. $\endgroup$
    – JonTheMon
    Commented Nov 20, 2014 at 20:26
  • $\begingroup$ @JonTheMon same here! :) $\endgroup$
    – A E
    Commented Nov 20, 2014 at 20:27
  • 5
    $\begingroup$ "Unlimited but finite"? I'm not quite sure what that means. In theory, if you ignore the laws of physics and the doors could fit in to infinitely small spaces, then an infinitely long sequence could be created with an "unlimited" amount of such doors. But, I guess the "but finite" clause is meant to suggest you can't fit an infinite amount in the hallway? $\endgroup$
    – Bob
    Commented Nov 21, 2014 at 2:08
  • 2
    $\begingroup$ @Bob That was my immediate reaction as well. I read this as you can use as many doors as you want, but not an infinite number. Presumably this is to prevent answers involving Xeno's paradox style physics tricks. $\endgroup$ Commented Nov 21, 2014 at 2:32
  • $\begingroup$ @Esoteric You read that correct :D $\endgroup$
    – warspyking
    Commented Nov 21, 2014 at 2:39

6 Answers 6


To the best of my knowledge, it is impossible to have an infinite loop when starting on the far left.

The best reasoning I can provide is that once you enter the first door, it is impossible to ever enter that door again from the left. Since your loop is already 'breaking', you'll then never be able to enter the path between the second A-B again.

Ultimately, you run into the case where you will only ever walk the path between the two letters once. A good way to look at this is to consider the Start/End as a pair of doors themselves.

[Start] [You] A D B A C B C D ... [End]

In the long run, the only loop you're bound to be stuck in is the one you started between, which in this case is the losing factor.


It's impossible.

If you never reach the end, it must be because you got stuck in an infinite loop. This requires that you enter the same teleportation door twice at some point. Consider the first time that this happens, and what happened immediately beforehand. Because you can't go towards the left, you can only possibly enter the leftmost door once. Therefore the repeated door must have another door immediately to its left, and you must have just come out of that one both times. But this contradicts the fact that it's the first time you used a door twice.

Therefore you can't get stuck in a loop, and must eventually reach the end.

  • $\begingroup$ Ah, earliest counterexample. Why didn't I think of that? $\endgroup$ Commented Nov 20, 2014 at 20:50

A lateral thinking answer (well, not so much lateral as its complement...):

Yes, it's possible, by thinking vertically. Structure the hallway like so:
start A end

Walking through the left of door A dumps you out of the A on the ceiling, placing you once again on the left of door A. This setup also has the benefit of making it impossible to walk through the hallway from right to left, as walking through A from the right will push you upward out of the A on the ceiling, depositing you on the floor above. Or, more likely, in the middle of the solid matter creating the ceiling and killing you. Or just disallowing travel in that direction if you want to be a spoilsport about it.

Note that the A B A B placement in the question was just an example, not a requirement that the doors be placed linearly. The placement requirements only state that the doors be added in the hallway, and that you use an arbitrary but finite number of doors.

  • $\begingroup$ Literally lateral! $\endgroup$
    – clabacchio
    Commented Nov 21, 2014 at 15:18
  • 2
    $\begingroup$ Now you're thinking with portals. $\endgroup$
    – Tim C
    Commented Nov 4, 2015 at 20:37

Impossible. Walking such a path in reverse, you could never reach the starting point.

Since the number of doors is finite and you never reach the end, you will eventually reach a door for the second time, at which point you will find yourself in a loop.

This, however, is impossible. You could not have started in a loop, because no door is left of the left-most door. Nor could you have entered a loop, because walking the path in reverse, you could never leave the loop. Notice that any path you walk can be walked in reverse as well, and loops forward are also loops in reverse.

  • 2
    $\begingroup$ Welcome to Puzzling Stack Exchange! Would it be possible for you to expand your answer to explain why it is correct, and how it differs from existing answers? Thank you! $\endgroup$
    – user20
    Commented Nov 21, 2014 at 8:18
  • $\begingroup$ Thank you Emrakul! This answer doesn't differ substantially from the others, really. Actually, the main reason I posted it was because it was simply more concise and in that way clearer. I added a bit of explanation. $\endgroup$
    – Michael
    Commented Nov 22, 2014 at 3:58
  • $\begingroup$ Makes sense! Thanks for your edits; they definitely improved your answer significantly. $\endgroup$
    – user20
    Commented Nov 22, 2014 at 4:01

DISCLAIMER: This should possibly be a comment but I don't have the reputation to do that :( It is NOT proof, just perhaps a start on the idea.

Let's start by considering what we know. Every time the 'player' hits a door from the left, they exit the corresponding from the right. Hence the player, in order to leave the circuit of doors, must exit the last door on the line. If the player leaves the last door, $a_2$, then they must enter it's correspondent door, $a_1$. So in order to create an infinite loop, we would have to make sure that this never happens.

In short, we would have to place the correspondent door $a_1$ such that it was never passed in part of our theoretical infinite loop of teledoors. If this was the case for door $a_1$, it would have to be effectively sectioned off from the remaining teledoors such that it could never be accessed by the player. To do this, let's say we were to use a set of doors, $p_1$ and $p_2$, to surround door $a_1$ so that it could never be entered. By entering door $p_1$ we would exit from $p_2$ on the other side of $a_1$, skipping it altogether.

However, what would happen after that? Consider the incomplete sequence of doors $p_1, a_1, p_2, q_1, a_2$. Here we are left with the issue of where to place our 'restarter', $q_2$. After all, in an infinite loop of a finite number of doors, the sequence must iterate. Hence, with nowhere to place $p_2$ so that the loop is infinite, we may assume that an infinite loop is impossible to create.

  • $\begingroup$ Putting that as an answer was right. Comments don't allow line breaks or the MathJax formatting (I believe), so that'd have been a mess to read. ^^; $\endgroup$
    – Xrylite
    Commented Nov 20, 2014 at 21:11

If I understood correctly, the doors effectively reverse the direction of the traveller, so in the example:


The traveller would enter the left-hand A travelling left to right, exit the right-hand A travelling right to left, thereby entering the left-hand A again, this time exiting right-hand A going left to right and ending her run.

There is no solution where the traveller would turn around and head back the other way because the traveller is always travelling forward in the sequence, regardless of the number of doors she travels through.

I had a look at a way of producing a mirror, forcing the traveller to hit a wall and travel back the way they came, but all the doors act in the same way. You would need a type of door that doesn't reverse the direction of the traveller in order to... reverse the direction of the sequence.

Doors are always paired, so the traveller is always reversed twice (i.e. no change) eventually before exiting the sequence.

  • $\begingroup$ I think you misunderstood. By my reading if you go in the left of one door you come out of the right of the matching door so you in fact keep going in the same direction at all times. $\endgroup$
    – Chris
    Commented Nov 20, 2014 at 21:07
  • $\begingroup$ The way I understood it is the teleports preserve direction. So traveling the AA example would essentially look like this [----->A A----->] $\endgroup$ Commented Nov 20, 2014 at 21:13
  • $\begingroup$ Ahhh, okay. Yep, re-reading the OP it's clear I misread. Sorry! $\endgroup$
    – m-smith
    Commented Nov 20, 2014 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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