door – open or close ?

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 question: what state are the doors in after the last pass? which are open which are closed?) 

Only perfect square doors will be open at the end.

For any given door, say door #36, you will visit it for every divisor it has. so 36 has 1 & 36, 2 & 18, 3 & 12, 4 & 9 ,6&6.

So on pass 1 i will open the door, pass 2 i will close it, pass 3 open, pass 4 close, pass 6 open, pass 9 close, pass 12 open, pass 18 close and pass 36 open.

For every pair of divisors the door will just end up back in its initial state.But since  36 is a perfect square, so you will only visit door #36, on pass 1, 2,3,4,6,9,12,18 and 36… leaving it open at the end since 6 * 6 is same as just one 6 and hence door will not return to its initial position for perfect squares.

Hence , only perfect square doors will be open at the end.

Resolving technical problems:

Solve your technical problems instantly

We provide Remote Technical Support from Monday to Sunday, 7:00PM to 1:00 AM

Mail your problem details at writeulearn@gmail.com along with your mobile numberand we will give you a call for further details. We usually attend your problems within 60 minutes and solve it in maximum 2 days.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.