## 100 Doors

100 closed lockers. You begin by opening all 100 lockers. Next, you close every second locker. Then you go to every third locker and close it if it is open or open it if it is closed (call this toggling the locker). After your 100th pass of the hallway, in which you toggle only locker number 100, how many lockers are open?

*Solution:*

If a number has an even number of *distinct* factors, then the door with that number will be flipped an even number of times. All numbers including prime numbers have an even number of factors except the perfect squares. The doors whose numbers are perfect squares have an odd number of distinct factors. So those doors will be flipped an odd number of times. Since the initial state of all doors was “Closed”, those doors that are perfect squares will be flipped to “Open”. There are 10 numbers less than or equal to 100 that are perfect squares. So the answer must be 10 doors??

what do you mean by “distinct”?

by the word ‘distinct’ what I mean is, “Non repetitive factors”. For example when u factorize 25 we get 1,5,5,25 as factors. But distinctly 1,5,25 totally 3 which is odd. Similarly all perfect squares have odd number of distinct factors. Hope you got it. 🙂