100 Doors Puzzle, state of doors at end?
You have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the first door every time. the first time through you visit every door and toggle the door (if the door is closed, you open it, if its open, you close it). the second time you only visit every 2nd door (door #2, #4, #6). the third time, every 3rd door (door #3, #6, #9), ec, until you only visit the 100th door.
What state are the doors in after the last pass? Which are open which are closed?
Puzzle asked in: Google,Adobe,Amazon,Oracle
Answer – Only perfect square doors will be open at the end.
For example, after the first pass every door is open. on the second pass you only visit the even doors (2,4,6,8…) so now the even doors are closed and the odd ones are opened. the third time through you will close door 3 (opened from the first pass), open door 6 (closed from the second pass), etc..
question: what state are the doors in after the last pass? which are open which are closed?
solution: you can figure out that for any given door, say door #42, you will visit it for every divisor it has. so 42 has 1 & 42, 2 & 21, 3 & 14, 6 & 7. so on pass 1 i will open the door, pass 2 i will close it, pass 3 open, pass 6 close, pass 7 open, pass 14 close, pass 21 open, pass 42 close. for every pair of divisors the door will just end up back in its initial state. so you might think that every door will end up closed? well what about door #9. 9 has the divisors 1 & 9, 3 & 3. but 3 is repeated because 9 is a perfect square, so you will only visit door #9, on pass 1, 3, and 9… leaving it open at the end. only perfect square doors will be open at the end.
1.It depends on the number of factors the Door ‘i’ has(including 1 and i ).for example,Door Number having odd number of Factors , then it would be Opened.else it will be Closed.
Ex 1:76 – factors are-1, 2, 4, 19, 38, 76…even(6)factors it has .. so 76th door will be closed..
Ex 2:64- factors are- 1,2,4,8,16,32,64..odd(7) factors has..so 64th door will be opened
2.Only Perfect square doors will be open …
More puzzles to try-
- 3 + 3 = 3 5 + 4 = 4 1 + 0 = 3 2 + 3 = 4 ...Read More »
- There are 10 stacks of 10 coins each. Each coin weights 10 gms. However, one stack of coins is defective ...Read More »
- Which clock works best? The one that loses a minute a day or the one that doesn’t work at all?Read More »
- Paul, Sam and Dean are assigned the task of figuring out two numbers. They get the following information: Both numbers ...Read More »
- Five puzzleFry ship’s pirates have obtained 100 gold coins and have to divide up the loot. The pirates are all ...Read More »
- Four days are there which start with the letter ‘T‘. I can remember only two of them as “Tuesday , Thursday”. ...Read More »
- Two fathers took their sons to a fruit stall. Each man and son bought an apple, But when they returned ...Read More »
- A farmer is taking her eggs to the market in a cart, but she hits a pothole, which knocks over ...Read More »
- Let it be simple and as direct as possible. Interviewer : Tell me how much time (in days) and money would ...Read More »
- Solve this logic sequence puzzle by the correct digit- 8080 = 6 1357 = 0 2022 = 1 1999 = ...Read More »
- A man leaves his house in the morning to go to office and kisses his wife. In the evening on ...Read More »
- Jasmine, Thibault, and Noah were having a night out and decided to order a pizza for $10. It turned out ...Read More »
- Which letter replaces the question markRead More »
- A murderer is condemned to death. He has to choose between three rooms. The first is full of raging fires, ...Read More »
- Richie established a very strange number system. According to her claim for different combination of 0 and 2 you will ...Read More »
- The result of math class test came out. Fariha’s mark was an even number. Srabon got a prime!! Nabila got ...Read More »
- Robi is a very serious student. On the first day of this year his seriousness for study was 1 hour. ...Read More »
- Ragib: I got digits of a 2 digit number Sakib: Is it an odd? Ragib: Yes. Moreover, the sum of ...Read More »
- A boy asks his father, “what is the age of grand father?“. Father replied “He is x years old in ...Read More »
- If u r genius solve it:- 40 * 14 = 11 30 * 13 = 12 20 * 12 = ...Read More »