# Which doors are open in the end?

344 views

There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then close, if close then open) them in following way:

In first walk, the person toggles every door.

In second walk, the person toggles every second door, i.e., 2nd, 4th, 6th, 8th, …

In third walk, the person toggles every third door, i.e. 3rd, 6th, 9th, …

………
……….

In 100th walk, the person toggles 100th door.

Which doors are open in the end?

posted Jul 24, 2017

Ten doors are open in the end.
1st, 4th, 9th, 16th, 25th, 36th, 49th, 64th, 81th and 100th doors(perfect square number doors) are open.

Solution:
A door is toggled in i th walk if i divides door number. For example the door number 45 is toggled in 1st, 3rd, 5th, 9th and 15th walk.
The door is switched back to initial stage for every pair of divisors. For example 45 is toggled 6 times for 3 pairs (5, 9), (15, 3) and (1, 45).
It looks like all doors would become closes at the end. But there are door numbers which would become open, for example 16, the pair (4, 4) means only one walk. Similarly all other perfect squares like 4, 9, ….

So the answer is 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100.

Similar Puzzles

A thief enters a shop and threatens the clerk, forcing him to open the safe. The clerk says, "The code for the safe is different every day, and if you hurt me you'll never get the code". But the thief manages to guess the code on his own.

How did the thief manage to open the safe ?

+1 vote

Which statements are true?

1. The number of the first true statement here added to the number of the second
false statement gives the number of a statement which is true.

2. There are more true statements than false.

3. The number of the second true statement added to the number of the first false
statement gives the number of a statement that is true.

4. There are no two consecutive true statements.

5. There are at most three false statements.

6. If this puzzle consisted of statements 1 to 5 only, then the answer to the following
question would still be the same.

A prisoner is facing three doors.
He is told that behind one of them, there is a lady,
and behind the other two there are tigers.
The sign on the door of the room containing the lady is true.
At least one of the other signs is false, maybe both.

The signs say
Room 1: A tiger is in room 2
Room 2: A tiger is in this room
Room 3 : A tiger is in room 1

Assuming that the prisoner will get eaten immediately
when opening the door to a room containing a tiger,
and moreover assuming that he wants to keep alive,
Which door should he open?

+1 vote

There are 13 caves arranged in a circle. There is a thief hiding in one of the caves. Each day the the thief can move to any one of of the caves that is adjacent to the cave in which he was staying the previous day. And each day, you are allowed to enter any two caves of your choice.

What is the minimum number of days to guarantee in which you can catch the thief?

Note: Thief may or may not move to adjacent cave. You can check any two caves, not necessarily be adjacent. If thief and you exchange your caves, you will surely cross at some point, and you can catch the thief immediately.