Friday, October 2, 2009

The Locker Problem


In the locker problem we had to find out which lockers, out of a thousand, were opened and closed after a thousand students changed the state of the lockers. The first person would open all the lockers, the second change the state of every second one, the third change the state of every third one, and so on and so on. After making a chart of about 50 lockers and going through the pattern, marking it each time it was open or closed as well as how many times its state was changed, my group found that every perfect square locker number was open while the rest of the lockers were closed. We also found that the lockers had a pattern, one open, two shut, one open, four shut, etc.

Looking at the data we found that every closed locker had an even amount of factors, meaning its state was changed an even amount of times. The lockers that were open in the end were the only ones with an odd amount of factors, and its state was changed an odd amount of times. This meant that only perfect squares had an odd number of factors, or an odd number of times their state was changed in the case of the problem. For example four has the factors two, four, and one, because 1x4=4, and 2x2=4, and you only count two once when you list the factors. This relates to the lockers because each locker number will be opened or closed by each of its factors once. Student one, two, and four are the students that will open or close locker number four because they are the factors in this problem. Four has three factors, so it was opened, then closed, then opened. In the case of another number, like 21, there will always be an even amount of factors, one, seven, three, and twenty-one, making it have four factors., i.e. being opened, closed, opened, and then closed by the twenty-first person, and never hit again. Only lockers hit an odd amount of times were open because, as seen in the diagram above (click on it to enlarge), when a locker was hit an even amount of times, it ended up being closed.

In the end of the problem we found out that there are only 31 perfect squares within a thousand giving you 31 lockers open, and 969 closed. In terms of finding a general rule in order to solve this problem further, it would be extremely difficult, even with the pattern found above (1 open, 2 shut, 1 open, 4 shut). The general rule is hard to find because as you extend the problem, the number of closed lockers increases, along with the number of perfect squares. So, if we had to solve this equation for two thousand lockers I would stick to using either the pattern, or just find the perfect square locker numbers within the total amount.

No comments: