Monday, October 20, 2008

Both: The Slamming Doors

Here's this week's problem:

Imagine a long hallway, filled with closed doors. Let's say 10 doors to start. Now find 9 of your friends, and proceed as follows:

1) You walk down the hall, opening every door. Now all the doors are open

2) Your first friend walks down the hall, flipping the status of every second door. So, they will re-close the 2nd, 4th, 6th, 8th, and 10th doors. Now every other door is open or closed.

3) Your next friend walks down the hall, flipping the status of every 3rd door. So, the 3rd door will go from open (from when you opened it in step 1) to closed, the 6th door will go from closed (see step 2) to open, and door 9 will go from closed (step 1) to open.

4) Your next friend will flip every 4th door
5) Your next friend will flip every 5th door
6) Your next friend will flip every 6th door
...and so on, until the last person flips just the last door.

The Challenge: Which doors are open in a hallway of 100 doors after you and 99 friends walk through?

Hint: For this case of 10 doors, the image below should help you see what's going on in each step. Before anyone has opened or closed any doors, they're all closed (imagine the doors are painted blue, so the blue bars mean a closed door, and a white space means an open door). When you go through first and open them all, everything goes white, then person #2 flips every other door, and so on.... You can do this by hand without too much trouble, but 100 doors is way too many doors to figure out by hand -- concentrate on doing the cases up to 10, see if you can identify the pattern, and then try to figure out why that pattern shows up. The prize will only be awarded if you can explain the pattern!

Photobucket

No comments: