You were invited to a party. A very rich man come to the party and said something that made everyone even you froze. He says," I have created a puzzle that requires 100 people I will tell the directions at my secret vault in the city bank". People decided to to a small contest to see the first 100 people to participate in the puzzle. You were in the first 100 so you go to the city bank. The man explains ", Everyone is given a key, person 1 will open every locker, person 2 will close every second lock, person 3 will open an odd multiple and close and even multiple, this will continue on until the 10 lockers are left, the words in those lockers will give you a key to answer my question: What is the lonely number so far today?." Before anyone could do anything you step forward and told the rich man" I know what lockers will stay open". So here's the question what numbers will stay open?
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.
If person 1 opens every locker and person 2 closes every 2 n d locker then every odd lockers are open and every even lockers are closed. Then person 3 and onward persons has to do nothing because always an odd multiple of any number will remain open and even multiple of any number will remain closed. I assume that the question says that 'every person opens the closed locker and closes the opened locker he encounter in multiples of his number. And at very beginning all the lockers are closed. For example, person 5 will encounter lockers 5, 10, 15, 20, . . . , 100 so he close every opened locker among these and open every closed locker.'
Person 1 open all the lockers because for him all the lockers are closed. Then person 2 close every 2nd locker. Person 3 open every closed locker with multiple of 3 and close every opened locker with the multiple of 3 and so on. In this way, locker no. n will be encountered by all the divisors of n . The n t h locker will remain open if the number of divisors of n is odd.
Let n has the prime factorization as : n = p 1 a 1 p 2 a 2 p 3 a 3 ⋯ p m a m . Then the number of divisors is given by d ( n ) = ( a 1 + 1 ) ( a 2 + 1 ) ( a 3 + 1 ) ⋯ ( a m + 1 )
Now if n is a non square number then at least one of the a i is odd which makes at least one of the factor a i + 1 even and hence d ( n ) even. So the locker with non square number will be closed. Now if n is a square number then all the a i are even so that all the a i + 1 are odd which makes d ( n ) odd. So all the locker with square number are remain open. Hence the answer is 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 lockers are open at last.