Date: Tue, 29 Sep 1998
Subject: Students and lockers

Name: Mike

Who is asking: Other
Level: Secondary

Question:
There is a row of 1000 lockers.
There is a line of 1000 students.

Student number 1 starts at the first locker and opens all 1000. Student number 2 starts at the second locker and closes every other one. Student number 3 starts at the third locker and goes to every third one, closing the open ones and opening the closed ones. Student number 4 does the same with every fourth locker and so on down the line... After all 1000 students have gone how many lockers are open and which ones are they?

Please help! There is proboly a simple solution but we couldnt figure it out for the life of us. Please let us know how you solve it.

Hi Mike,

A locker is open if an odd number of students either open or close it. Also the nth student either opens or closes locker k precisely if n divides k evenly. Hence locker n is open if n has an odd number of divisors.

Let's try a smaller number, like 10 lockers.

Locker Number12345 678910
# of Divisors12232 4243 4

From 1 to 10, we can see that the numbers 1, 4, and 9 have an odd number of divisors.

When we look at these numbers, we notice that there is a pattern. They are all the numbers from 1 to 10 which are squares of an integer. Going beyond 10, 11 has two divisors since it is a prime, and the divisors of 12 are 1, 2, 3, 4, 6 and 12, an even number of them. They go together in pairs, 1 and 12, 2 and 6, and 3 and 4. However the divisors of 16 are 1, 2, 4, 8 and 16, an odd number. If you try to pair them you get 1 and 16, 2 and 8, and you are left with 4 since 4x4=16.

Can you now show in general that the lockers that are open are the lockers with numbers that are a squares?

Cheers,
Patrick and Penny

Go to Math Central

To return to the previous page use your browser's back button.