Locker door state puzzle

Lockers numbered 1 to 100 stand in a row at the school gym. When the first student arrives, she opens all the lockers. The second student then goes through and recloses all the even-numbered lockers; the third student changes the state of every locker whose number is a multipls of 3.

This continues until 100 students have passed through. Which lockers are now open?

Answer:

Let us trace the first few doors as they are operated by the students:
1 -> 1 (open)
2 -> 1, 2 (close)
3 -> 1, 3 (close)
4 -> 1, 2, 4 (open)
5 -> 1, 5 (close)
6 -> 1, 2, 3, 6 (close)
7-> close
8->1, 2, 4, 8(close)
9-> 1, 3, 9 (open)
10-> 1, 2, 5, 10(close)
11->1, 11(close)
12 -> 1, 2, 3, 4, 6, 12(close)
13 -> close
14 -> 1, 2, 7, 14 (close)
15 -> 1, 3, 5, 15 (close)
16 -> 1, 2, 4, 8, 16 (open)
17 -> (close)
18 -> 1, 2, 3, 6, 9, 18 (close)

What can be infered is that, a state of the door depends on the
number of divisors:
Even : then door is closed
Odd : Open

Now the multiples of a number ususally occur in pairs, i.e j*k = n
( exception is for 1)
for example for 10 we have 1 * 10, 2 * 5
i.e effects of (1,10) (2,5) is nullified, i.e a pair nullifies the effect.
the door is in its original state.

But for perfect squares, we have something like j*j = n, and since j happens only once there is no nullifying effect, so the perfect squares will be open. for ex take 16 : we have the pairs, (1*16) (2*8) (4*4), and the last pair does not nullify each other.

So, the perfect squares, 1, 4, 16, 25, 36, 49, 64, 81, 100 will be open

No comments: