# Case of Open Locker Number 4...

Every day, $$100$$ students enter a school that has $$100$$ lockers. All the lockers are closed when they arrive.

Student $$1$$ opens every locker.

Student $$2$$ closes every second locker.

Student $$3$$ changes the state of every third locker i.e. he opens it if it is closed and closes it if its open.

Student $$4$$ changes the state of every fourth locker and so on... so that student $$n$$ changes the state of every $$nth$$ locker.

One day, on account of a blizzard, several students are absent. Regardless, those present complete the procedure and simply skip the students who are absent. For e.g. if student $$3$$ is absent, then nobody changes the state of every third locker.

At the end of the process, it is found that only locker number $$4$$ is open and all the other $$99$$ lockers are closed...

How many students were absent that day ?

More interestingly, given a locker number n, find a general rule that keeps only locker n open and all other lockers closed.

×