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
or
2.Only Perfect square doors will be open …
Your Answer
More puzzles to try-
Should you stay, or switch, or doesn’t it matter?
The host of a game show, offers the guest a choice of three doors. Behind one is a expensive car, ...Read More »Shock at resturant puzzle
A young lady was approached by an elderly woman who took her hand and meeting her eyes said to her, ...Read More »New year party celebration puzzle
Mr Andrew wants to have a party on new year eve i.e. 1st of Jan, where he will be serving ...Read More »Decode The Riddle
Decode below three cipher riddles 26 L of the A 7 D of the W 1000 Y in a MRead More »What single line can you add to the following statement to make it true?
What single line can you add to the following statement to make it true? 5+5+5=550Read More »How many times did the coin land on heads ?
Two friends were betting. One said to the other, “The coin will be flipped twenty times and each time the ...Read More »Rings of marriage riddle
What are the three rings of marriage ?Read More »Initializing an array in constant time
Consider the following array operations. Init(N,d) initializes an array of N elements so that each element has value d. Once ...Read More »Mysterious Bridge Brain teaser
A boat full of people goes under a bridge and when it comes out the other side not a single ...Read More »Srabon wanted to pass
The result of math class test came out. Fariha’s mark was an even number. Srabon got a prime!! Nabila got ...Read More »Mona Wants To Divide
Mona has a birth day circular cake ,and a clock. She invited 7 of her best friends! Now she wanted ...Read More »Tricky Equation
By moving just one matchstick, you need to make the below statement true. Can you do it?Read More »Know the age puzzle
Tony’s father is 45. He is 15 years older than twice Tony’s age. How old is Tony? John is twice ...Read More »Common in mentioned animal
What do the following animals have in common ? 1. Cat 2. Fox 3. Raccoon 4. Squirrel 5. MouseRead More »Train and man escaping from tunnel riddle
A man walking home takes a shortcut through a train tunnel. A quarter of the way in, he hears a ...Read More »Count The Square
Can you count the number of squares in the given picture?Read More »Rebus representation
what does this below rebus represent identXQQQQQMERead More »Coin rotating riddle
How many times does a coin rotate in rolling completely about another coin, of the same size, without slipping, whilst ...Read More »Counting number of squares
A network of 20 x 10 squares is given to you. Can you calculate how many unique squares and rectangles ...Read More »10 Word Rebus
What word is identified by the below rebus? Your Your Your Your Your Your Your Your Your YourRead More »