# At the end of the ceremony how many lockers are open?

+1 vote
239 views

A middle 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.
At the end of the ceremony how many lockers are open?

posted Jun 9, 2014

The only lockers that remain open are perfect squares (1, 4, 9, 16, etc) because they are the only numbers divisible by an odd number of whole numbers; every factor other than the number's square root is paired up with another. Thus, these lockers will be 'changed' an odd number of times, which means they will be left open. All the other numbers are divisible by an even number of factors and will consequently end up closed.

So the number of open lockers is the number of perfect squares less than or equal to one thousand. These numbers are one squared, two squared, three squared, four squared, and so on, up to thirty one squared. (Thirty two squared is greater than one thousand, and therefore out of range.) So the answer is thirty one.

Similar Puzzles
+1 vote

If Kareem Khan is standing in a row of prisoners at 9th position from both end of a line. How many Prisoners are standing in total ?

In how many ways the letters of the word ‘CHEKOSLOVAKIA’ can be arranged such that “SL” always comes together and ‘H’ and ‘I’ at the end places?

An intelligent trader travels from one place to another carrying 3 sacks having 30 coconuts each. No sack can hold more than 30 coconuts. On the way he passes through 30 checkpoints and on each check point he has to give one coconut for each sack carrying.

How many coconuts are left in the end?

There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then close, if close then open) them in following way:

In first walk, the person toggles every door.

In second walk, the person toggles every second door, i.e., 2nd, 4th, 6th, 8th, …

In third walk, the person toggles every third door, i.e. 3rd, 6th, 9th, …

………
……….

In 100th walk, the person toggles 100th door.

Which doors are open in the end?