# Lockers Maths Puzzle

• November 25th 2012, 04:15 AM
miansons
Lockers Maths Puzzle
What is the answer to below puzzle? I am unable to solve this.(Thinking)

"A high school has a strange principal. On the first day, he has his students perform an odd opening day ceremony:

There are one thousand lockers and one thousand students in the school. The principal asks the first student to go to every locker and open it. Then he has the second student go to every second locker and close it. The third goes to every third locker and, if it is closed, he opens it, and if it is open, he closes it. The fourth student does this to every fourth locker, and so on. After the process is completed with the thousandth student, how many lockers are open?"

---------------------------------------------------------------------------------------------------------------------------------------
Here is your Maths Help: Length Converter
• November 25th 2012, 05:59 AM
jakncoke
Re: Lockers Maths Puzzle
Well, for any n where $1 \leq n \leq 1000$ if we are on student number k, then then nth locker changes status (closes or opens) if and only if k divides n.
At the beginning, all the lockers were closed, so if we arrange (k, n/k) as pairs, the net result is that nothing changed from where we started. i.e the nth locker maintains its same status as it had in the beginning, closed. Since the only pairs that could affect the status of the nth locker is when n/k = k, or when k^2 = n. Thus all your 1^2, 2^2, 3^2,4^2, etc... are the only ones who have a status different from when they began as closed. So perfect squares are open. Since 31^2 is the last perfect square less than or equal to 1000, there are 31 lockers opened.
• November 25th 2012, 06:00 AM
grillage
Re: Lockers Maths Puzzle
This is a well known problem. There are lots of resources on the net to learn about it. James Tanton has a good video here

Locker-Problem Demonstration: Part II - YouTube