There is a school with 1,000 students and 1,000 lockers. On the first day of term the headteacher asks the first student to go along and open every single locker, he asks the second to go to every second locker and close it, the third to go to every third locker and close it if it is open or open it if it is closed, the fourth to go to the fourth locker and so on. The process is completed with the thousandth student. How many lockers are open at the end?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
It comes down to the number of factors the locker number has. All positive numbers have an even number of factors unless they are prime. The number 50 would be opened by student one closed by student 2 opened by 5 closed by 10 opened by 25 and close again by 50 never to be touched by the others. Locker 49 however is opened by one closed by seven and opened by student 49. Once you know that its a case of figuring out how high a prime can be under a thousand